A: scanf(“%d”,&score);
B: scanf(“%d”,&student);
C: scanf(“%d”,&stu.score);
D: scanf(“%d”,&student.score);
举一反三
- 若已经定义:struct stu { int a, b; } student ;则下列输入语句中正确的是( ) A: scanf("%d",&a); B: scanf("%d",&student); C: scanf("%d",&stu.a); D: scanf("%d",&student.a);
- 若已经定义struct stu { int a; int b; } student; ,则下列输入语句中正确的是 。? scanf("%d",&stu.a);|scanf("%d",&student);|scanf("%d",&student.a);|scanf("%d",&a);
- 若已经定义struct stu { int a, b; } student ; 则下列输入语句中正确的是 。 A: scanf("%d",&a); B: scanf("%d",&student); C: scanf("%d",&stu.a); D: scanf("%d",&student.a);
- 有如下定义:struct student{ int num; char name[20]; int age;};struct student stu[30];下面输入语句正确的是()。 A: scanf("%d",&stu.age); B: scanf("%d",stu[0].age); C: scanf("%d",&stu[0].age); D: scanf("%d",stu.age);
- 有如下定义:struct student{ int num; char name[20]; int age;};struct student stu[30];下面输入语句正确的是()。 A: scanf("%d",&stu.age); B: scanf("%d",stu[0].age); C: scanf("%d",&stu[0].age); D: scanf("%d",stu.age);
内容
- 0
若已经定义: struct stu { int a, b; } student ; 则下列输入语句中正确的是( ) A: scanf("%d",&a); B: scanf("%d",&student); C: scanf("%d",&stu.a); D: scanf("%d",&student.a);
- 1
若已经定义struct stu { int a, b; } student ; 则下列输入语句中正确的是 。 A: scanf("%d",&a); B: scanf("%d",&student); C: scanf("%d",&stu.a); D: scanf("%d",&student.a);
- 2
若已经定义struct stu { int a, b; } student ; 则下列输入语句中正确的是 。 A: A)scanf("%d",&a); B: B) scanf("%d",&student); C: C) scanf("%d",&stu.a); D: D) scanf("%d",&student.a);
- 3
以下各项用于定义结构体类型,并定义结构体变量,其中正确的是________。 A: struct student { char num[5]; int score; }; student stu1,stu2; B: struct student{ char num[5]; int score;};struct student stu1 stu2; C: struct student { char num[5]; int score=96; }; struct student stu1,stu2; D: struct student{ char num[5]; int score;};struct student stu1,stu2;
- 4
分析下面的程序,下列说法中错误的是 ________ 。 #define NULL 0 #include "conio.h" struct stu { long num; char name[20]; int score; struct stu * next; }; int main() { struct stu *head,*p,*pa,*pb,*pc; pa=(struct stu *)malloc(sizeof(struct stu)); pb=(struct stu *)malloc(sizeof(struct stu)); pc=(struct stu *)malloc(sizeof(struct stu)); scanf("%ld%s%d",&pa->num,pa->name,&pa->score); scanf("%ld%s%d",&pb->num,pb->name,&pb->score); scanf("%ld%s%d",&pc->num,pc->name,&pc->score); head=pa; pa->next=pb; pb->next=pc; pc->next=NULL; p=head; while(p!=NULL) { printf("%ld,%s,%d\n",p->num,p->name,p->score); p=p->next; } }