有以下程序段,输出结果为()。#includestruct student{int num;char name[20];float score;};main(){struct student stu[5];printf("%d",sizeof(stu));}
A: 140
B: 160
C: 5
D: 随机值
A: 140
B: 160
C: 5
D: 随机值
举一反三
- 有以下程序段,输出结果为()。 #include<stdio.h> struct student {int num; char name[20]; float score; }; main() {struct student stu[5]; printf("%d",sizeof(stu)); }
- 以下程序段,在空白处填写()能使程序正确运行并输出结果。 #include struct student {long num; char name[10]; char sex; float score; }; main() {struct student stu={10101,"lili
- 在如下结构体中,不正确的是( )。 A: struct student {char name[10]; float score; }; B: struct stu[5] {char name[10]; float score; }; C: struct student {char name[10]; float score; } stu[5]; D: struct {char name[10]; float score; }stu[5];
- 下列程序的输出结果第一行是_____,第二行是_______。 #include [iostream] #include [cstring] #include [iomanip] using namespace std; struct student { int num; char name[20]; double score; }; void fun(struct student *s); int main() { struct student stu={12345, "Zhangwei", 98.0}; cout[<stu.num<<","<<stu.name<<","<<stu.score<<endl; fun(&stu); cout<<stu.num<<","<<stu.name<<","<<stu.score<<endl; return 0; } void fun(struct student *s) { s-]num=23456; strcpy(s->name, "Liming"); s->score=88; }
- 以下程序段,在空白处填写()能使程序正确运行并输出结果。 #include struct student {long num; char name[10]; char sex; float score; }; main() {struct student stu={10101,"lili",'m',89.5},*pt; printf("%.2f",pt->score); }