有以下定义语句:structstudent{intnum;charname[9];}则不能正确定义结构体数组并赋初始值的是
A: structstudentstu[]={{1,"zhangsan"},{2,"lisi"}};
B: structstudentstu[2]={1,"zhangsan",2,"lisi"};
C: structstudentstu[2]={{1,"zhangsan"},{2,"lisi"}};
D: structstu[]={{1,"zhangsan"},{2,"lisi"}};
A: structstudentstu[]={{1,"zhangsan"},{2,"lisi"}};
B: structstudentstu[2]={1,"zhangsan",2,"lisi"};
C: structstudentstu[2]={{1,"zhangsan"},{2,"lisi"}};
D: structstu[]={{1,"zhangsan"},{2,"lisi"}};
举一反三
- 设STU为某结构体类型的别名,且其成员有int id;和char name[32]; STU s[2]={ {101, "zhangsan"},{100, "lisi"}}, *p=s;puts(p->;name); 输出_______, printf("%d", (++p)->;id); 输出__________。 A: zhangsan 和 100 B: zhangsan 和 101 C: lisi 和 100 D: lisi 和 101
- 下列定义数组的方法错误的是( )。 A: array(1, 2) B: [1, 2] C: (1, 2) D: ['name'=>'zhangsan', 'age'=>20]
- 下面程序的输出结果是( )。 #include<iostream> using namespace std; template<class T> T max(T x,T y) return(x>=y x:y); void main() cout<<max(5,8)<<endl; cout<<max("zhangsan","lisi"); A: 8 B: zhangsan C: 8 D: lisi E: 5 F: zhangsan G: 5 H: lisi
- 以下结构体的定义语句中,正确的是() A: structstudent{intnum;charname[10];intage;};stu; B: struct{intnum;charname[10];intage;}student;structstudentstu; C: structstudent{intnum;charname[10];intage;}stu; D: structstudent{intnum;charname[10];intage;};studentstu;
- 对结构体类型变量定义不正确的是() A: #defineSTUDENTstructstrdentSTRDENT{charname;intnum;}std; B: structstudent{charname;intnum;}stu; C: struct{charname;intnum;}std; D: struct{charname;intnum;}student;structstudentstu;