What Is The Pointer? Explain.
- Null Pointer
- Void Pointer
- Wild Pointer
- Dangling Pointer
Ans. Pointer: – Pointer is the special variable which stored another variable address. There are some types of pointer.
Null Pointer: – Null pointer by assigning the null value at the time of pointer declaration. This method is useful when you do not assign any address to the pointer. A null pointer always contains value 0.
Void Pointer: – The void pointer is a generic pointer that isn’t associated with any data type. A void pointer can be type casted to any type, so it is instrumental in assigning the different types of variables to the void pointer.
Wild Pointer: – If a pointer isn’t initialized to anything, it’s called a wild pointer. Dereferencing a wild pointer has undefined behavior that may crash the program or give a garbage value.
Dangling Pointer: – A dangling pointer is a pointer that refers to a memory location that has been released or deleted.