95
有以下程序
#include
main()
{
struct STU { char name[9]; char sex; double score[2]; };
struct STU a={"Zhao", 'm', 85.0, 90.0}, b={"Qian", 'f', 95.0, 92.0};
b=a;
printf("%s,%c,%2.0f,%2.0f\n", b.name, b.sex, b.score[0], b.score[1]);
}
程序的运行结果是
有以下程序
#include
struct STU{ char name[9]; char sex; int score[2]; } ;
void f( struct STU a[] )
{ struct STU b = {"Zhao", 'm', 85, 90};
a[1] = b;
}
main()
{ struct STU c[2]={ {"Qian", 'f', 95, 92}, {"Sun", 'm', 98, 99} };
f(c);
printf( "%s,%c,%d,%d,", c[0].name, c[0].sex, c[0].score[0], c[0].score[1] );
printf( "%s,%c,%d,%d\n", c[1].name, c[1].sex, c[1].score[0], c[1].score[1] );
}
程序运行后输出结果是