What is NULL pointer and void pointer and what is their use?

What is NULL pointer and void pointer and what is their use?

- A NULL pointer has a fixed reserved value that is not zero or space, which indicates that no object is referred. NULL pointers are used in C and C++ as compile-time constant. NULL pointer represents certain conditions, like successor to the last element in linked list, while a consistent structure of the list of nodes are maintained.
- A void pointer is a special pointer that points to an unspecified object. A null pointer can not be dereferenced. The address manipulation can directly be done by pointer casting to and from an integral type of sufficient size.

Define void pointer using C++.

- In C++, void represents the absence of type, so void pointers are pointers that point to a value that has no type.
- The void pointers can point to any data type.
- We can declare void pointer as follows :
Void *p;
Difference between pass by value and pass by reference - C++
Difference between pass by value and pass by reference - In pass by value approach, the called function creates another copies of the variables passes as arguments.....
What are references in C++? What is a local reference?
What are references in C++? - A restricted type of pointer in C++ is known as a reference...
What is static class data? - C++
What is static class data? - Static data members of a class are declared by preceding the member variable’s declaration with the keyword static....
Post your comment