Was wondering about Null pointers , do they really point to location zero in memory and does that location got all the bits zero. Does this mean a NULL pointer points to itself?

Node<Type> *A = 0;
A = Find_Node(Position-1)->R_Link;

I have this code , where "Find_Node" function returns a pointer to a class "Node" , sometimes the function will return a null pointer , will this store 0 in A ?
i m guessing arrow operator won't handle it and will give an error.

Recommended Answers

All 3 Replies

The null pointer constant (NULL) is guaranteed (by the compiler) not to point to any real object. It never points to "location zero in memory". Likewise the constant NULL is guaranteed to be 0.

Thanks a lot for info.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.