elibraryportal Logo

Pointer Type Declaration

There are different types of Pointer that is...

  1. NULL Pointer
  2. Dangling Pointer
  3. Generic Pointers
  4. Wild Pointer
  5. Complex Pointers
  6. Near Pointer
  7. Far Pointer
  8. Huge Pointers

1) NULL Pointer

NULL pointer is a pointer which is pointing to nothing. NULL pointer points the base address of segment.

OR

When NULL Pointer is used, you do not have any address assigned to the pointer. A null pointer always contains value 0.

Example:-

2) 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.

3) Generic pointer

Void pointer is known as generic pointer.Generic pointer is a pointer which can point type of data. It does not have any standard data type. A void pointer is created by using the keyword void. It can be used to store an address of any variable.

Example 1:-

Example 2:-

Output

 The size of pointer is:4

4) Wild pointer

A pointer in c which has not been initialized is known as wild pointer.

Example 2:-

Output

 timeout: the monitored command dumped core
sh: line 1: 95298 Segmentation fault      timeout 10s main

5) Complex pointer

  1. Pointer to function
  2. 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
  3. Pointer to structure
  4. Pointer to union
  5. Multilevel pointers

6) Near pointer

The pointer which can points only 64KB data segment or segment number 8 is known as near pointer.

7) Far 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.

8) Huge 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.

Next Topic