Pointer to a Pointer


Since every variable declared in a program is assigned an address, so a pointer variable also has an address. Pointer to a pointer means that a variable can be declared which can store the address of a pointer variable.

Program to show how pointer to pointer operates.
#include < stdio.h>
#include <conio.h>
main ( )
{
            int i=3, *j, **k;
            clrscr ( );
            j=&i;
            k=&j;
            printf (“ Value of i = %d”,i);
            printf (“\n Value of *j =%d”,*j);
printf (“\n Value of **k =%d”,**k);
getch( );
}

Output:
Value of i=3
value of *j =3

value of **k= 3

Previous                                                                                    Next


Powered by Blogger.