主要针对int long char double 字节长度的识记。
1 #include <stdio.h>
2
3 int main()
4 {
5 int a[100];
6 int (*p)[100];
7 p=&a;
8
9 long b[100];
10 long (*p2)[100];
11 p2=&b;
12
13 double c[100];
14 double (*p3)[100];
15 p3=&c;
16
17 char d[100]="sadfjksajdfl;askdlf";
18 char (*p4)[100];
19 p4=&d;
20
21 printf("int:a=%d",sizeof(a));
22 printf("*p=%d\n",sizeof(p));
23 printf("long:b=%d",sizeof(b));
24 printf("*p2=%d\n",sizeof(p2));
25 printf("double:c=%d",sizeof(c));
26 printf("*p3=%d\n",sizeof(p3));
27 printf("char:d=%d\n",sizeof(d));
28 printf("*p4=%d",sizeof(p4));
29 return 0;
30 }
输出:
int:a=400*p=4
long:b=400*p2=4
double:c=800*p3=4
char:d=100