What is a Null Pointer and how it can be implemented?

Explain Null Pointer and its use.Where to use it? How it can be implemented in C++?


3 Answers
1-3 of  3
3 Answers
  • A NULL Pointer in C is a special type of pointer which points to nowhere i.e. not anywhere. Pointers declared in program but not initialized contain garbage addresses, pointing to locations beyond the storage allocated to program by the compiler. But these are not NULL Pointers. 
     

  • Null Pointer is a pointer which doesn't pointing to any variable.It doesn't exists.It is always 0.
    If you don’t have address to be assigned to pointer then you can  use NULL.
    In C++:
    float *ptr { 0 };
    Here ptr is NULL pointer.
    Similarly ,you can use int,double etc.

Object Oriented Programming

Didn't get the answer.
Contact people of Talent-Object Oriented Programming directly by clicking here