A-A+
#include<stdio.h>typedef struct abc{int a b c;
问题详情
#include<stdio.h>
typedef struct abc
{int a,b,c;
};
main()
{struct abe s[2]={{1,2,3),{4,5,6}};
int t=-s[0].a+s[1].b;
printf("%dn",t);
}
参考答案
正确答案:
4
[解析]
#include<stdio.h>
typedef struct abc{
int a,b,c;
};/*定义一个结构体类型*/
main()
{struct abc s[2]={{1,2,3},{4,5,6}};/*定义一个结构体数组s[2]并赋初值*/
int t=-s[0].a+s[1].b;/*引用结构体数组元素的成员进行计算,计算t的值*/
printf("%d\n",t);
}