Pointer indirection in C.

 

01  #include<stdio.h>
02
03 int main()
04 {
05 int a=10; //integer variable
06
07 int *p;
08
09 int **q;
10
11 int ***r;
12
13 p=&a; // address of 'a'
14
15 q=&p; // address of 'p'
16
17 r=&q; // address of 'q'
18
19 printf("Value of a : %d nn",a);
20 printf("Value of *p : %d nn",*p);
21 printf("Value of **q : %d nn",**q);
22 printf("Value of ***r : %d nn",***r);
23
24 /*
25
26 a <- *p <- **q <- ***r
27
28 */
29
30 return 0;
31 }
 
 
OUTPUT :

Value of a : 10

Value of *p : 10

Value of **q : 10

Value of ***r : 10

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.