int *p = NULL;
P: The address of the memory pointed to by the pointer p
*p: The value of the memory address pointed to by the pointer p
&p: The address of the pointer p
1 #ifndef _code_pointer_demo01_h_2 #define_code_pointer_demo01_h_3 4#include <stdlib.h>5#include <string.h>6#include <stdio.h>7 8 intMain () {9 Ten intA =Ten; One A Char*P1 =NULL; - - Char**P2 =NULL; the -P1 =0x111111; -P2 =0x222222; - +P1 = &A; - +printf"P1 =%d, &p1 =%d, *p1 =%d \ n", p1, &p1, *p1); Aprintf"A =%d, &a =%d \ n", A, &a); at - //directly modify the value of the P1 -P1 =0x111112; - -printf"P1 =%d \ n", p1); - in //indirectly modifying the value of P1 -P2 = &p1;//assign the address of the P1 to P2 to +*P2 = -;//indirect assignment, p2 is the address of P1 - theprintf"P1 =%d \ n", p1); * $ return 0;Panax Notoginseng } - the #endif //_code_pointer_demo01_h_
Wisdom Podcast Videos Learn---->>>> pointers int *p, what P is, what &p is, what *p is