Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6956783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:54:53+00:00 2026-05-27T14:54:53+00:00

what happens in memory when I, say, do the following: in C: char *c=NULL;

  • 0

what happens in memory when I, say, do the following:
in C: char *c=NULL;
in java: MyClass mc=null;
what happens in memory, how is this null represented in memory in both of these languages? Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:54:54+00:00Added an answer on May 27, 2026 at 2:54 pm

    In C you are basically setting the pointer to zero value. In fact

    char *c = NULL;
    

    is equivalent to

    char *c = 0;
    

    Zero pointer cannot be dereferenced since there is no memory mapping for this address. On platforms with virtual memory, an attempt to do so triggers a page fault transferring control to the operating system which then usually handles the situation by killing the offending process (in UNIX your process receives Segmentation Violation signal SIGSEGV).

    In Java, all non-primitive type variables are references. null in Java is a literal denoting the only value of a special unnamed type. This type can be cast to any reference type allowing you to put null into any reference variable. An attempt to use such reference to access an object will throw an unchecked exception called NullPointerException. See JLS 3.10.7 and JLS 4.1 for details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What happens in the memory when a class instantiates the following object? public class
What exactly happens, in terms of memory, when i declare something like: char arr[4];
So what really happens when someone say 'new' in PHP I believe in C/Java,
Let's say you have a string like this: char* a=01234 Letting &a=0000, &(a+1)=0001, &(a+2)=0002,
Suppose I have a following constructor in C++ class: MyClass::MyClass() { char* buffer =
I am always confused about static variables, and the way memory allocation happens for
This happens repeatedly and is very annoying. I upload some PHP code to a
This code causes the following exception, sometimes : Attempted to read or write protected
Say I have a class Foo class Foo { } I do following assignments:
Say I'm working with Sharepoint (this applies to other object models as well) and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.