#include
#include
struct s1
{
char a;
int c;
char b;
}s1_test[][2] = {{'j',123,'b'},
{'o',52,'k'},
{'k',21,'n'},
{'p',19,'l'}};//为什么 struct s1 s1_test[][2] 和 struct s1 s1_test[4][2] 一样
int main()
{
int a[2][2] = {1,2,3,4};
struct s1 *p;
printf("%d\n",a);
printf("%d\n",a+1);
printf("%d\n",&a);
printf("%d\n",&a+1);
p = &a;
printf("%d\n",*a);
printf("%d\n",*a+1);
printf("%d\n",1);
printf("%d\n",2);
p = &s1_test;
//p = (struct s1 *) &s1_test;// 强制类型转换 (struct s1 *)(*struct s1_test[4])
printf("%d\n",s1_test);
printf("%d\n",s1_test+1);//+24
printf("%d\n",&s1_test);
printf("%d\n",&s1_test+1);//+96????[4][2]??为什么???
printf("%d\n",p);
printf("%d\n",p+1);
printf("%d\n",*p);
// printf("%d\n",*p+1);//结构体指针不允许这样操作
return 0;
}
阅读(831) | 评论(0) | 转发(0) |