NULL Pointer
A pointer doesn't highlight any memory area. It, by and large, focuses on the NULL or 0th memory area, so in straightforward words, no memory is designated to a NULL pointer.
Null pointer vs Uninitialized pointer -
- The two are diverse as the Null pointer focuses on the 0th memory area, which implies that it doesn't possess any memory area.
- Conversely, an uninitialized pointer implies that the pointer possesses trash esteem.
- The trash worth can be any worth the city worker allots to the pointer, which might highlight some memory area.
Therefore, Null pointers are liked.
Null pointer vs Void pointer -
Null pointer and void pointer might sound like their tedious implications cross-over something over the top, however, they are different as the NULL pointer is worth, and the void pointer is a sort.
- Null, which implies it isn't highlighting any memory area
- Void, which implies the worth will be set by what kind of significant worth we store in it. If we compare it to a number, its worth will be int, and assuming we pass a person variable in it, its worth will be scorch, etc.
Benefits -
- Instate the pointer variable without allotting a particular location to it.
- Use it to check whether or not a pointer is genuine.
- Utilized for examination with different pointers to check whether or not they are highlighting some memory address.
- Error dealing with on account of C programming.
- Pass a NULL pointer at places where we would rather not pass a pointer with a legitimate memory address.
0 Comments