This section illustrates you the concept of Multiple Indirection.
C permits the pointer to point to another pointer. This creates many layers of pointer and therefore called as multiple indirection. A pointer to a pointer has declaration is similar to that of a normal pointer but have more asterisk sign before them. This indicates the depth of the pointer. You can see in the given example, we have declared an integer variable i initialized to 100. The statement int ** pt creates a pointer which points to pointer to a variable with int value. We have passed the value of i to pointer pt2 and to pass the value of pt2 to pt1, we have used the statement pt1 = &pt2; which shows the Multiple Indirection.
Here is the code:
Output will be displayed as:
Posted on: February 5, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles