Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2585216
  • 博文数量: 877
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 5920
  • 用 户 组: 普通用户
  • 注册时间: 2013-12-05 12:25
个人简介

技术的乐趣在于分享,欢迎多多交流,多多沟通。

文章分类

全部博文(877)

文章存档

2021年(2)

2016年(20)

2015年(471)

2014年(358)

2013年(26)

分类: LINUX

2014-04-30 14:40:39


#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;
}
阅读(749) | 评论(0) | 转发(0) |
0

上一篇:&a和a的区别

下一篇:数组名与指针的区别

给主人留下些什么吧!~~