POINTER TO POINTER, MULTIPLE INDIRECTION - C-Tutorial

Latest

Tuesday, 4 October 2016

POINTER TO POINTER, MULTIPLE INDIRECTION

POINTER TO POINTER     (OR)    MULTIPLE INDIRECTION


  • A pointer variable that holds address of an ordinary variable is known as pointer-to-variable. 
  • A pointer variable that holds address of another pointer variable is known as pointer-to-pointer.  For this, add an asterisk symbol for each level of reference.


            Example:        int x = 10;
                                    int *p;
                                    p=&a;

                                    int **q;
                                    q=&p;


/* EXAMPLE PROGRAM FOR POINTER TO POINTER VARIABLE */

main()
{
            int a=5,*p,**q;
            clrscr();
            p=&a;
            q=&p;
            printf("\nValue with p is:%d",*p);
            printf("\nValue with q is:%d",**q);

}

No comments:

Post a Comment