填空题:程序阅读:结构体数组及结构体指针
阅读以下程序,写出程序的运行结果:
#include <stdio.h>
struct stu
{
int x;
int *y;
}*p;
int dt[4]={10,20,30,40};
struct stu a[4]={40,&dt[0],50,&dt[1],60,&dt[2],70,&dt[3]};
int main()
{
p=a;
printf("%d,",++p->x);
printf("%d,",(++p)->x);
printf("%d",++(*p->y));
return 0;
}
//程序的运行结果是:
答案:
第1空:41,50,21 ||
#include <stdio.h>
struct stu
{
int x;
int *y;
}*p;
int dt[4]={10,20,30,40};
struct stu a[4]={40,&dt[0],50,&dt[1],60,&dt[2],70,&dt[3]};
int main()
{
p=a;
printf("%d,",++p->x);
printf("%d,",(++p)->x);
printf("%d",++(*p->y));
return 0;
}
//程序的运行结果是:
答案:
第1空:41,50,21 ||