题目内容

以下关于结构体类型及变量的声明正确的是_____

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};

#includestruct book{char name[32]; //书名float price; //定价char publisher[32]; //出版社};以下关于结构体的使用正确的是_____

A. struct book math;math.name="The C Programming Language";math.price =39.9;math.publisher="China Machine Press";
B. struct book prog={"The C Programming Language", 69.9, "China Machine Press"};printf("%s, %f, %s\n", prog);//输出教材名称、定价和出版社
C. struct book prog;scanf("%s%f%s\n", &prog);//输入教材名称、定价和出版社
D. struct course{char name[32]; //课程名称int csHour; //课时char speciality[16]; //专业struct book textbook; //教材} thecprogramming;

以下关于结构体变量的描述错误的是_____

A. 结构体变量可以传递给一个有同类型形参的函数
B. 函数可以返回结构体类型的返回值
C. 结构体变量可以作为一个整体进行输入和输出
D. 一个已初始化的结构体变量可以给另一个同类型结构体变量赋值

struct point{int x;int y;};struct rect{struct point ldpoint; //左下角struct point rupoint; //右上角}r1={{1,2},{3,4}}, *pr1=&r1;以下语句使用正确的是_____

A. printf("left down point:%d, %d; right up point:%d, %d\n", r1.ldpoint, r1.rupoint);
B. printf("%d\n", pr1.ldpoint.x);
C. printf("%d\n", pr1->rupoint->x);
D. printf("%d\n", pr1->ldpoint.x);

答案查题题库