A: struct student s1={"Li",{1,1,2000}};
B: struct student s1={'Li',1,1,2000};
C: struct student s1={"Li",1,1,2000};
D: struct student s1={"Li",1,1};
举一反三
- 下面结构体的定义如下:struct student{ char name[32]; struct date{ int day; int month; int year; }birthday;};错误的初始化语句是: A: struct student s1={'Li',1,1,2000}; B: struct student s1={"Li",{1,1,2000}}; C: struct student s1={"Li",1,1,2000}; D: struct student s1={"Li",1,1};
- 下面结构体的定义如下:struct student{ char name[32]; struct date{ int day; int month; int year; }birthday;};错误的初始化语句是: A: struct student s1={'Li',1,1,2000}; B: struct student s1={"Li",{1,1,2000}}; C: struct student s1={"Li",1,1,2000}; D: struct student s1={"Li",1,1};
- 中国大学MOOC: 下面结构体的定义如下:struct student{ char name[32]; struct date{ int day; int month; int year; }birthday;};错误的初始化语句是:
- 下面定义结构变量的语句中错误的是。 未知类型:{'options': ['struct student{ int num; char name[20]; } s;', 'struct { int num; char name[20]; } s;', 'struct student{ int num; char name[20]; }; struct student s;', 'struct student{ int num; char name[20]; }; student s;'], 'type': 102}
- 以下变量定义,错误的是: A: struct student{int num, char name[20];} s; B: struct {int num, char name[20];} s; C: struct student{int num, char name[20];}; struct student s; D: struct student{int num, char name[20];} ; student s
内容
- 0
若有以下定义,则对变量student1中“生日”的正确赋值方式是( )。struct student{ int num; char name[20], sex; struct { int year, month, day; } birthday;} ; struct student student1; A: student1.birthday.year = 2003;student1.birthday.month = 5;student1.birthday.day = 1; B: year = 2003;month = 5;day = 1; C: birthday.year = 2003;birthday.month = 5;birthday.day = 1; D: student1.year = 2003;student1.month = 5;student1.day = 1;
- 1
已知学生记录描述为:struct student { int no ; char name[20]; char sex; struct { int year; int month ; int day ; } birth ; } s ;设结构变量 s 中的“birth”是“1985年10月1日”,则下面正确的赋值方式是( ) A: year=1985 month=10 day=1 B: birth.year=1985birth.month=10birth.day=1 C: s.birth.year=1985s.birth.month=10s.birth.day=1 D: s.year=1985 s.month=10 s.day=1
- 2
对以下定义,能输出字符串"Mary"的语句是( )。struct student { char name[20]; int age; }; struct student stu[100]={"John",16,"Paul",17,"Mary",18 }; A: printf("%s",stu[2].name); B: printf("%s",stu[1].name); C: printf("%s",stu[2]); D: printf("%s",stu[1]);
- 3
已知学生记录描述为:struct student{int no ;char name[20];char sex;struct{int year;int month;int day ;} birth ;}s ;设结构变量s中的birth值为1985年10月1日,则下面正确的赋值方式是_______。 A: year=1985month=10day=1 B: birth.year=1985birth.month=10birth.day=1 C: s.year=1985s.month=10s.day=1 D: s.birth.year=1985s.birth.month=10s.birth.day=1
- 4
已知学生记录描述为: struct student { int num; char name[20]; struct { int year; int month; int day; }birth; }; struct student s; 下列对 “ 生日”的正确赋值方式是( )