有以下程序: #include<stdio.h> main() { struct STU { char name[9]; char sex; double score[2]; }; stru

admin2019-01-14  17

问题 有以下程序:
  #include<stdio.h>
  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;
    pfinff(’’%s,%C,%2.of,%2.of\n’’,b.name,b.sex,b.score[0],b.score[1]);
  }
  程序的运行结果是(    )。

选项 A、Qian,m,85,90
B、Zhao,m,85,90
C、Zhao,f,95,92
D、Qian,f,95,92

答案B

解析 本题考查结构体初始化操作。本题中可以直接将结构体a赋值给b,所以输出的结果和a一样,B选项正确。
转载请注明原文地址:https://jikaoti.com/ti/ZTf0FFFM
0

最新回复(0)