Pointers To Pointers


Pointer is known as a variable containing address of another variable. The pointer variables also have an address. The pointer variable containing address of another pointer variable is called as pointer to pointer. This chain can be continued to any extent.

Example: program to print value of a variable through pointer and pointer to pointer.

#include<stdio.h>
#include<conio.h>
Void main ()
{
  int x=10,*p, **q;
  P=&x;
  Q=&p;
  clrscr ();
  printf("value of x=%d address of x=%u", x, &x);
  printf("through *p value of x=%d address of x=%u",*p, p);
  printf("through **q value of x=%d address of x=%u", **q,*q);
  getch ();
 }
            

Output:
Value of x=10 address of x=2000
Through *p value of x=10 address of x=2000
Through **q value of x=10 address of x=2000

Copyright © 2018-2020 TutorialToUs. All rights reserved.