#include<stdio.h> //指针数组, 数组里面的每一个元素都是指针 int main() { int a = 10; int b = 20; int c = 30; // int* p1 = &a int* p2 = &b int* p3 = &c int* number[3] ={&a,&b,&c}; printf("%d sizeof\n ", sizeof(number)); for (int i=0; i<sizeof(number)/sizeof(number[0]);i++) { printf("%d\n",*number[i]); } }
#include<stdio.h> //指针数组, 数组里面的每一个元素都是指针 int main() { int a = 10; int b = 20; int c = 30; // int* p1 = &a int* p2 = &b int* p3 = &c int* number[3] ={&a,&b,&c}; printf("%d sizeof\n ", sizeof(number)); for (int i=0; i<sizeof(number)/sizeof(number[0]);i++) { printf("%d\n",*number[i]); } //定义一个指针用来保存number首元素的地址 //unmber = &unmber[0] = &(int*) = int** int** p = number; for (int i=0; i<sizeof(number)/sizeof(number[0]);i++) { printf("%d\n",**(p+i)); } }
24 sizeof
10
20
30
10
20
30
标签:--,number,C语言,int,数组,printf,sizeof,指针 From: https://www.cnblogs.com/shunguo/p/16849376.html