有以下程序struc STU {char name[10];int num; };void f1(struct STU c){ struct STU b={“LiSiGuo”,2042};c=b; }void f2(struct STU *c){ struct STU b={“SunDan”,2044};*c=b; }main( ){ struct STU a={“YangSan”,2041},b={“WangYin”,2043 };f1(a);f2(b);printf(“%d %d\n”,a.num,b.num); }执行后的输出结果是( )A.2041 2044B.2041 2043C.2042 2044D.2042 2043

有以下程序

struc STU {

char name[10];

int num; };

void f1(struct STU c)

{ struct STU b={“LiSiGuo”,2042};

c=b; }

void f2(struct STU *c)

{ struct STU b={“SunDan”,2044};

*c=b; }

main( )

{ struct STU a={“YangSan”,2041},b={“WangYin”,2043 };

f1(a);f2(&b);

printf(“%d %d\n”,a.num,b.num); }

执行后的输出结果是( )

A.2041 2044

B.2041 2043

C.2042 2044

D.2042 2043


相关考题:

已知Student类是一个空类,stu1和stu2是Student类的两个对象,则通过“stu1.name='李晓明'”语句增加的属性可以通过()访问。 A.Student.name、stu1.name或stu2.nameB.Student.name或stu1.nameC.stu1.name或stu2.nameD.stu1.name

有以下程序includestruct STU{char name[10];int num;};void f(char*name, intnum){s 有以下程序 #include <string.h> struct STU { char name[10]; int num; }; void f(char *name, int num) { struct STU s[2]={{"SunDan",20044},{"Penghua",20045}}; num=s[0].num; strcpy(name,s[0].name); } main() { struct STU s[2]={{"YangSan",20041},{"LiSiGuo",20042}},*p; p=s[1]; f(p->name,p->num); printf("%s %d\n",p->name,p->num); } 程序运行后的输出结果是A.SunDan 20042B.SunDan 20044C.LiSiGuo 20042D.YangSan 20041

有以下程序: include struct STU (char name[10]; int num; }; 有以下程序: #include <string.h> struct STU (char name[10]; int num; }; void f(char *name, int num) {struct STU s[2]={{"SunDan",20044}.{"Penghua",20045}}; num=s[0].num; strcpy(name,s[0].name); } main() {struct STU s[2]={{"YangSall",20041},{"LiSiGao",20042}},*p;p=s[1]; f(p->name,p->num); printf("%s%d\n",p->name,p->num); } 程序运行后的输出结果是 ______。A.SunDan 20042B.SunDan 20044C.LiSiGuo 20042D.YangSan 20041

若能使程序运行后的输出结果如下: 201501 201502 201503 则空白处填写的表达式或语句应该是 #include <stdio.h> struct student { int age; char num[8]; }; int main() { struct student stu[3]={{20,"201501"},{21,"201502"},{19,"201503"}}; struct student *p=stu; ____________________ return 0; }A.printf("%sn",(*p).num); printf("%sn",(p)->num); printf("%sn",stu[2].num);B.printf("%sn",(p++).num); printf("%sn",(p++).num); printf("%sn",(p++).num);C.printf("%sn",(p)->num); printf("%sn",(p)->num); printf("%sn",(*p).num);D.printf("%sn",stu[0]->num); printf("%sn",stu[1]->num); printf("%sn",stu[2]->num);

设有以下结构体定义及初始化,表达式p->score的结果是()。 struct node { int num; float score; }stu[2]={101,91.5,102,92.5},*p=stu; A)101 B)91.5 C)102 D)92.5A.分析错误#B.该定义使stu[0].num=101,stu[0].score=91.5,stu[1].num=102,stu[0].score=92.5,p指向数组stu的首地址,p->score的值是stu[0].score。#C.分析错误#D.分析错误

【单选题】以下结构体的定义语句中,正确的是______。A.struct student {intnum; char name[10];int age;};stu;B.struct {int num;char name[10];int age;}student; struct studentstu;C.struct student {int num; char name[10];int age;}stu;D.struct student {int num; char name[10]; int age;}; student stu;

以下哪一个是Python合法的标识符?A.stu_nameB.stu-nameC.2nameD.*name

根据下面的定义,能输出字符串"Li"的语句是()。 struct person { char name[10]; int age; }; person stu[10]={"Zhang",18, "Li",17, "Ma",18, "Huang",18 };A.cout<< stu[2].name<<endl;B.cout<< stu[2].name[0]<<endl;C.cout<< stu[1].name<<endl;D.cout<< stu[1].name[0]<<endl;

以下结构体的定义语句中,正确的是______。A.struct student {int num; char name[10];int age;};stu;B.struct {int num; char name[10];int age;}student; struct student stu;C.struct student {int num; char name[10];int age;}stu;D.struct student {int num; char name[10]; int age;}; student stu;

若有以下类型说明,错误的叙述是()。 typedef struct {char name[10]; int age; }STU;A.name是结构类型STU的成员B.STU是一个结构类型变量名C.age是一个结构类型名D.age是结构类型STU的成员