网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

若结构体struct p定义如下: struct p { char name[20]; int age; }; 则下列声明和语句正确的是() 。

A.struct p p1; scanf("%s%d", p1.name, p1.&age);

B.struct p p1; p1={"Zhang", 20};

C.struct p p1; scanf("%s%d", p1->name, &p1->age);

D.struct p p1={"Zhang", 20};


参考答案和解析
struct STRU
更多 “若结构体struct p定义如下: struct p { char name[20]; int age; }; 则下列声明和语句正确的是() 。A.struct p p1; scanf("%s%d", p1.name, p1.age);B.struct p p1; p1={"Zhang", 20};C.struct p p1; scanf("%s%d", p1->name, p1->age);D.struct p p1={"Zhang", 20};” 相关考题
考题 设有定义:struct person{ int ID;char name[12];}p;请将 scanf("%d", 【 1 2 】 ); 语句补充完整,使其能够为结构体变量 p 的成员 ID 正确读入数据。

考题 已知函数的原形如下,其中结构体a为已经定义过的结构,且有下列变量定义struct a *f(int t1,int *t2,strcut a t3,struct a *t4)struct a p,*p1;int i;则正确的函数调用语句为A.p=f(10,i,p,p1);B.p1=f(i++,(int *)p1,p,p);C.p=f(i+1,(i+2),*p,p);D.f(i+1,i,p,p);

考题 有以下说明和定义语句 struct student { int age;char num[8]; struct student stu[3]={{20,"200401"},{21,"200402"},{19,"200403"}}; struct student *p=stu;}; 以下选项中引用结构体变量成员的表达式错误的是A.(p++)->numB.p->numC.(*p).numD.stu[3].age

考题 以下scanf函数调用语句中对结构体变量成员的引用不正确的是struct pupil{ char name[20];int ageint sex;} pup[5],*p;p=pup;A.scanf("%s",pup[0].name);B.scanf("%d",pup[0].age);C.scanf("%dT",(p-sex));D.scanf("%d",p-age);

考题 设有如下定义 struct ss { char name[10]; int age; char sex; } std[3],* p=std; 下面各输入语句中错误的是A.scanf("%d",(*p).age);B.scanf("%s",std.name);C.scanf("%c",std[0].sex);D.scanf("%c",(p->sex));

考题 现有如下定义:struct aa{int a;float b;char c;}*p;现需用malloc函数动态的申请一个struct aa类型大小的空间(由p指向),则定义的语句为: 【17】 。

考题 C数组名称是指针变量吗? 看这段程序,可是执行。#include stdio.hint main(int argc, char *argv[]){ struct info { char name[33]; int age; }; struct info aa[3]={"meng",20,"juan",29,"an",59}; struct info *p=aa; for(int i=0;i3;i++,p++) printf("%-6s %d\n",p-name,p-age);}将其改成这样:#include stdio.hint main(int argc, char *argv[]){ struct info { char name[33]; int age; }; struct info aa[3]={"meng",20,"juan",29,"an",59}; //struct info *p=aa; for(int i=0;i3;i++,aa++) printf("%-6s %d\n",aa-name,aa-age);}为什么就执行不了呢

考题 若有以下定义的语句: struct student { int age; int num;}; struct student stu[3]={{1001,20},{1002,19},{1003,21}}; main() { struct student *p; p=stu; …} 则以下不正确的引用是( )。A.(p++)->numB.p++C.(*p).numD.P=stu.age.

考题 设有定义:struct person{int ID;char name[12];}P;请将scanf(“%d”, 【 】);语句补充完整,使其能够为结构体变量P的成员ID正确读人数据。

考题 若定义下列结构体,结构体变量p的出生年份赋值正确的语句是( )。 struct st { int x; int y; int z; } struct worker { char name[20]; char sex; struct st birth; }p;A.x=1987B.birth.x=1987;C.p.birth.x=1987;D.p.x=1987;

考题 设定义下列结构体,结构体变量p的出生年份赋值正确的语句是( )。Struct st{ int x;inty;int z;}Struct worker{ char name[20];char sex;struct st birth;}p;A.x=1987B.birth.x=1987;C.p.birth.x=1987;D.p.x=1987;

考题 有如下说明和定义语句: struct student { int age; char num{8};}; struct student stu[3]={{20,"200401"},{21,"200402"),{19,"200403"}}; struct student *p=stu; 以下选项中引用结构体变量成员的表达式错误的是( )。A.(p++)->numB.p->numC.(*p).numD.stu[3].age

考题 若有下列说明和语句,则对结构体变量st中成员i的引用方式不正确的是( )。 Struct stu { int i; int name; }st,*p; p=st;A.st.iB.*p.iC.(*p).iD.p->i

考题 设定义下列结构体,结构体变量p的出生年份赋值正确的语句是( )。 stmct st { int x; int y; int z; } struct worker { char name[20]; char sex; struct st birth; }p;A.x=1987B.birth.x=1987;C.p.birth.x=1987;D.p.x=1987;

考题 有以下说明和定义语句struct student{ int age; char num[8];};struct student stu[3]={{20,"200401"},{21,"200402"},{10\9,"200403"}};struct student *p=stu;以下选项中引用结构体变量成员的表达式错误的是A.(p++)-num B.p-num C.(*p).num D.stu[3].age

考题 有以下说明和定义语句:struct student{int age; char num[8] ;};struct student stu [3] = { { 20, "200401" } , {21, "200402" } , {19, "200403" } };stract student * p = stu;以下选项中引用结构体变量成员的表达错误的是( )。A.(p++) ->numB.p- >numC.( *p).numD.stu[3].age

考题 设有如下定义 struct ss { char name [10]; int age; char sex; }std[3],*p=std; 下列各输入语句中错误的是_______。A.scanf("%d",(*p).age);B.scanf("%s",std.name);C.scanf("%c",std[0].sex);D.scanf("%c",(p->sex));

考题 设定义下列结构体,结构体变量p的出生年份赋值正确的语句是( )。 struct st { int x; int y; int z; } struct worker { char name[20]; char sex; struct st birth; }p;A.x=1987B.birth.x=1987;C.p.birth.x=1987;D.p.x=1987;

考题 设有定义语句“struct {int a;float b;char c;}abc,*p;”,则对结构体成员a的引用可以是( )。 A、abc.aB、abc->aC、(*p).aD、p->a

考题 以下程序的输出结果是______。includestruct stu{int num; char name[10]; int age;};v 以下程序的输出结果是______。#include<stdio.h>struct stu{ int num; char name[10]; int age;};void fun(struct stu*p){ printf("%s\n",(*p).name);}main(){ struct stu students[3]={ {9801,"Zhang",20}, { 9802,"Wang",19}, { 9803,"Zhao",18} }; fun(students+2);}A.ZhangB.ZhaoC.WangD.18

考题 以下scanf函数调用语句中对结构体变量成员的不正确引用是 struct pupil { char name[20]; int age int sex; } pup[5],*p; p=pup;A.scanf("%s",pup[0].name);B.scanf("%d",pup[0].age);C.scanf("%dT",(p->sex));D.scanf("%d",p->age);

考题 某C语言结构体的定义如下。 struct date { int year, month, day; }; struct worklist { char name[20]; char sex; struct date birthday; }person; 若对变量person的出生年份进行赋值,正确的赋值语句是(33)。A.year=1976B.birthday. year=1976C.person. year=1976D.person. birthday. year=1976

考题 设有如下定义 struct ss { char name[10]; int age; char sex; }std[3], * p=std; 下面各输入语句中错误的是A.cin>>(* p).age);B.cin>>std.name);C.cin>>std[0].sex);D.cin>>(p->.sex));

考题 下列关于结构型变量的定义语句中,错误的是( )A.typedef struct CCCB.define GGG struct { char name[20];GGG CCC { char name[20]; int age; int age; }GGG; }; GGG abc ; GGG CCC abc;C.structD.struct { char name[20]; { char name[20]; int age; int age; }ccc; }abc; CCC abc;

考题 若有以下说明和语句: struct student{          int age;          int num;  }std, *p;  p=std;  则下面对该结构体变量std中成员age的引用方式错误的是()。 A、std.ageB、*p.ageC、(*p).ageD、p-age

考题 有以下说明语句:struct Worker{int no;char name[20];};Worker w,*p=w;则下列错误的引用是()A、w.noB、p-noC、(*p).noD、*p.no

考题 单选题以下scanf函数调用语句中对结构体变量成员的不正确引用的是()。  struct node{      char name[20];      int age;      int sex; }student[5],*p;  p=student;A scanf(“%s”,student[0].name);B scanf(“%d”,student[0].age);C scanf(“%d”,(p-sex));D scanf(“%d”,p-age);

考题 单选题有以下说明语句:struct Worker{int no;char name[20];};Worker w,*p=w;则下列错误的引用是()A w.noB p-noC (*p).noD *p.no