Ad Code

6/recent/ticker-posts

Null Pointer | Data Structure

Null Pointer

We have already seen the void pointers in our previous blog. If you haven't read it then click here

After void pointers there is another type of pointer which NULL pointer. 

Null pointer is a special type of pointer which does not point to any memory location. Simply it represents the location of invalid memory.Also when we assign the null or zero value to the pointer then that pointer becomes the NULL pointer. 

Example, 

Use of NULL pointer

  1. It is used to initialize the pointer, specially when the pointer is not assigned to any valid memory address 
  2. While using malloc function it is best for handling errors
The important fact about the null pointer is that the size of the null pointer is depends on the platform.  And it is similar to the size of normal pointers. 

Post a Comment

0 Comments

Ad Code