• 2022-06-19
    若已经定义“struct stu {int num,score;} student;”,则下列输入语句中正确的是( )。
    A: scanf(“%d”,&score);
    B: scanf(“%d”,&student);
    C: scanf(“%d”,&stu.score);
    D: scanf(“%d”,&student.score);
  • D

    内容

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