Understanding and understanding of pointers
Int main (void)
{
Int;
Int * p; int ** p1; a = 5; p = & a; p1 = & p; printf ("\ n "); printf ("the address of a is % p \ n", & a); printf ("the value of p is % p and the adress of p is % p \ n ", p, & p); printf ("the value of p1 is % p and the address of p1 is % p \ n", p1, & p1 ); printf ("\ n"); printf ("a's value is % d \ n", ); printf ("a's value is % d access by first pointer \ n", * p); printf ("a's value is % d access by second pointer \ n ", * (* p1); printf ("\ n ");}
The output result is as follows:
The address of a is invalid value of p is 0x7fffd57a181c and the adress of p is invalid value of p1 is 0x7fffd57a1808 and the address of p1 is 0x7fffd57a1810 a's value is 5a's value is 5 access by first pointera's value is 5 access by second pointer
Resolution:
P = &;
P = address of variable a = 0x7fffd57a181c
* P = value of a = 5 // Level 1 pointer
P1 = & p;
P1 = address of Variable p
* P1 = value of Variable p = address of variable
* (* P1) = * (value of Variable p) = * (address of variable a) = 5