- NULL Pointer
- Dangling Pointer
- Generic Pointers
- Wild Pointer
- Complex Pointers
- Near Pointer
- Far Pointer
- Huge Pointers
NULL Pointer :
Literal meaning of NULL pointer is a pointer which is pointing to nothing. NULL pointer points the base address of segment.
Examples of NULL pointer:
1 2 3 4 5 6
int *ptr=(char *)0;
float *ptr=(float *)0;
char *ptr=(char *)0;
double *ptr=(double *)0;
NULL is macro constant which has been defined in the heard file as :
#define NULL 0
Dangling pointer :
If any pointer is pointing the memory address of any variable but after some variable has deleted from that memory location while pointer is still pointing such memory location. Such pointer is known as dangling pointer and this problem is known as dangling pointer problem.
Generic pointer :
void pointer in c is known as generic pointer. Literal meaning of generic pointer is a pointer which can point type of data.
Here ptr is generic pointer.
- We cannot dereference generic pointer.
- We can find the size of generic pointer using sizeof operator.
- Generic pointer can hold any type of pointers like char pointer, struct pointer, array of pointer etc without any typecasting.
- Any type of pointer can hold generic pointer without any typecasting.
- Generic pointers are used when we want to return such pointer which is applicable to all types of pointers. For example return type of malloc function is generic pointer because it can dynamically allocate the memory space to stores integer, float, structure etc. hence we type cast its return type to appropriate pointer type.
Wild pointer :
A pointer in c which has not been initialized is known as wild pointer.
Complex pointer :
- Pointer to function
- Pointer to array
- Pointer to array of integer
- Pointer to array of function
- Pointer to array of character
- Pointer to array of structure
- Pointer to array of union
- Pointer to array of array
- Pointer to two dimensional array
- Pointer to three dimensional array
- Pointer to array of string
- Pointer to array of pointer to string
- Pointer to structure
- Pointer to union
- Multilevel pointers
In TURBO C there are three types of pointers. TURBO C works under DOS operating system which is based on 8085 microprocessor.
1. Near pointer
2. Far pointer
3. Huge pointer
The pointer which can points only 64KB data segment or segment number 8 is known as near pointer.
The pointer which can point or access whole the residence memory of RAM i.e. which can access all 16 segments is known as far pointer.
The pointer which can point or access whole the residence memory of RAM i.e. which can access all the 16 segments is known as huge pointer.