指针 打印
1 //指针 2 3 4 5 #include <stdio.h> 6 int main() 7 { 8 int num = 9; 9 int *ptr_num1 = # 10 11 //int *ptr_num2 = &ptr_num; //指针的地址 12 int **ptr_num2 = &ptr_num1; 13 14 15 printf("num变量的地址是:%p\t%x\n",ptr_num1,&num); //%p指针占位符 %X16进制占位符 16 printf("ptr_num对应的值为:%d\t%d\t",num,*ptr_num1); // 9 17 18 //通过指针的指针。访问原指针指向空间的值时,同样需要俩个星号 19 printf("指针变量ptr_num1地址是:%p\t%d\t",ptr_num2,**ptr_num2); 20 21 22 23 //使用指针修改变量值 24 //*ptr_num = 9999; 25 // printf("ptr_num对应的值为:%d\n",num); 26 27 return 0; 28 29 }
本文来自博客园,作者:Bytezero!,转载请注明原文链接:https://www.cnblogs.com/Bytezero/p/15071975.html