Photo of Hyacinth macaw by Roi Dimor on Unsplash
It is a pointer pointing to nothing. NULL pointer points to the base address of the segment.
int * ptr = (int) * 0; float * fptr = (float) * 0; double * dptr = (double) * 0; char * chptr = (char) * 0;
int * ptr = NULL; char * chptr = '\0';
#define NULL 0
A pointer pointing to the memory address of any variable (or object) which has been deleted from memory.
When a pointer points to a deleted memory address, the pointer is called as a dangling pointer.
Person p = new Person(); Person * pptr = &p; delete p; /* here pointer pptr (* pptr) is still pointing to the Person object which has been deleted. */
void pointer is known as generic pointer. It can point to any type of data.
void * ptr;
- We can’t de-reference a generic pointer.
- We can find the size of pointer using
- These pointers can hold any type of pointer such as char, int, float, structure, array, object etc without any typecasting.
- Any type of pointer can hold generic pointer without typecasting.
- Generic pointer can be used to implement dynamic datatype.
A pointer which has not been initialized is called as wild pointer.
int * ptr;
These are pointers pointing to derived data-types.
- Pointer to array
- Pointer to function
- Pointer to structure / union
- Pointer to object
- Multilevel pointers
These pointer modifiers were used in 1980’s-90’s before 32 bit architecture.
near : a 16 bit pointer that can address any byte in a 64k segment.
far : a 32 bit pointer that contains a segment and an offset.
huge : a 32 bit pointer in which the segment is “normalized” so that no two far pointers point to the same address unless they have the same value.
You can read this stack overflow answer for more information.
Thanks for reading. 🙏
If you liked it feel free to share with your dear ones.💗
And tell me what do you think in the comment box.💬
comments powered by Disqus