• Home
  • Tutorials
  • Interviews
  • Info Seed
  • Forums
  • Projects
  • Links
  • Contact Us
C Language
C POINTERS
INTRODUCTION
What are POINTERS?
Illustration of POINTER assignments
Illustration - II
Illustration - III
POINTER arithmetic- POINTER + number
POINTER - number
POINTER - POINTER
NULL POINTER
Common Errors
DEREFERENCING NULL
DANGLING POINTER
REFERENCING DE-ALLOCATED MEMORY
MEMORY MANAGEMENT

 

 

DEREFERENCING NULL

As we know NULL pointer is actually a pointer which points to nowhere and hence we can not dereference to the NULL pointer. It is a run time ERROR to point to the NULL pointer.

Int* x=NULL;

*x=3;     DEREFERENCING NULL ERROR

After execution of statement 1, in the memory map x can be described as follow:

www.exploreroots.com

Now if we try to execute statement2, which actually is trying to assign value to the pointee of the ponter x. But as we know, the above declared pointer has no pointee, hence now we can recognize an ERROR in the above set of statements and the ERROR is called DEREFERENCING NULL

 


previous next
| Copyright © 2009 exploreroots- All Rights Reserved | Disclaimer |