• 2022-05-26
    下列定义中,()是定义指向Stu对象数组的指针p。
    A: Stu*p[5];
    B: Stu(*p)[5];
    C: (Stu*)p[5];
    D: Stu*p();
  • B

    内容

    • 0

      若有以下说明和定义语句,则下面引用形式中不正确的是 ( )。 struct student { int age; int num; }; struct student stu[3]={{1001,20},{1002,19},{1003,21}}; struct student *p; p=stu;

    • 1

      若有以下定义语句,则以下错误的引用是( )。 struct student {int num,age;}; struct student stu[3]={{101,20},{102,19},{103,18}},*p=stu;

    • 2

      设有以下定义struct student{ int age; int num;}stu[5],*p=stu;int i;stu[0].num=10;则以下语句不正确的是 A: i=p->num; B: i=stu[0].num; C: i=(*p).num; D: p=&student.num;

    • 3

      以下对结构体变量stu成员age的非法引用是( )。 struct<br/>student {<br/>int num;<br/>int age; }; struct<br/>student stu,*p=&amp;stu; A: stu.age B: (*p).age C: student.age D: p-&gt;age

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