struct grade{int usualGrade; //平时成绩int finalGrade; //期末成绩};以下关于结构体数组的初始化正确的是_____
A. struct grade myGrade[2]={91,82,93}; 将给myGrade[0]的两个成员和myGrade[1]的第一个成员赋初值
B. struct grade myGrade[2]={91,82,,93};将给myGrade[0]的两个成员和myGrade[1]的第二个成员赋初值
C. struct grade myGrade[2]={91,93};和struct grade myGrade[2]={{91},{93}}; 是等价的
D. struct grade myGrade[]={{}, {}, {}}; 该语句初值列表为空,属于语法错误
查看答案
struct{int x;char pstr[16];}test = { 66,"have a try" }, *ptest = &test;以下关于结构体成员访问描述正确的是_____
A. 执行 printf("%s\n", ptest.pstr); 后输出"have a try"
B. 执行 printf("%c\n", ++*ptest->pstr); 后输出'i'
C. 执行 printf("%c\n", (*ptest->pstr)++); 后输出'i'
D. 执行 printf("%c\n", *++ptest->pstr); 后输出'v'
struct point{int x;int y;}pts[]={1,3,5,7}, *ptr;ptr=pts;以下关于结构体成员访问的描述错误的是_____
A. printf("%d\n", ptr->x); 输出1
B. printf("%d\n", *ptr.y); 输出3
C. printf("%d\n", (*(++ptr)).x); 输出5
D. printf("%d\n", (++ptr)->y); 输出7
以下关于结构体类型及变量的声明正确的是_____
A. struct student{char name[16];int age}stu1;
B. struct student{int age, rank}stu1;
C. struct student{char name[16];int age;float score;};student stu1;
D. struct student{char name[16];int age, rank;float score;};struct student student;
struct student{char name[16];int age;};以下关于结构体变量的初始化描述错误的是_____
A. struct student stu1={"john"; 18};
B. struct student stu1={"xiaoming", 19};struct sutdent stu2=stu1;
C. struct student stu1={"john"};
D. int age=19;struct student stu1={"john", age};