这道C语言题是什么意思?结果为6怎么算的啊!谢谢了!

[复制链接]
查看11 | 回复1 | 2011-4-6 03:35:31 | 显示全部楼层 |阅读模式
struct abc
{int a,b,c;};
main()
{struct abc s[2]={{1,2,3},{4,5,6}};
int t;
t=s[0].a s[1].b;
printf(\"%d\\n\",t);
回复

使用道具 举报

千问 | 2011-4-6 03:35:31 | 显示全部楼层
<pre id=\"best-answer-content\" class=\"reply-text mb10\">#includestdio.h
struct abc
{
int a,b,c;
};
void main()
{
struct abc s[2]={{1,2,3},{4,5,6}};
/*这是定义的一个长度为2结构体数组
s[0].a=1,s[0].b=2,s[0].c=3
s[1].a=4,s[1].b=5,s[1].c=6
*/

int t;
t=s[0].a s[1].b;
//这就是简单的加法运算,把值代入就行1 5的值赋给t
printf(\"%d\\n\",t);
}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行