单选题有以下程序:#include #include typedef struct{ char name[9]; char sex; float score[2];} STU;void f(STU *A){ strcpy(a-name,Zhao); a-sex='m'; a-score[1]=90.0;}main(){ STU c = {Qian,'f',95.0,92.0},*d=c; f(d); printf(%s,%c,%2.0f,%2.0f, d-name, c.sex, c.score[0], c.score[1]);}程序的运行结果是(  )。AQian,f,95,92BZhao,f,95,90CZhao,m,95,90DZhao,f,95,92

单选题
有以下程序:#include #include typedef struct{ char name[9]; char sex; float score[2];} STU;void f(STU *A){ strcpy(a->name,Zhao); a->sex='m'; a->score[1]=90.0;}main(){ STU c = {Qian,'f',95.0,92.0},*d=&c; f(d); printf(%s,%c,%2.0f,%2.0f, d->name, c.sex, c.score[0], c.score[1]);}程序的运行结果是(  )。
A

Qian,f,95,92

B

Zhao,f,95,90

C

Zhao,m,95,90

D

Zhao,f,95,92


参考解析

解析:
f函数调用时,结构体数组名作为实参传给形参指针,结构体指针a指向数组c的首地址。因此,f可以对数组c中的元素赋值,故返回主函数之后,数组c中的成员值已被更新。main函数中有赋值语句“*d=&c;”,指针d指向结构体数组c的首地址,故d->name=c.name,输出结果为Zhao,m,95,90。答案选择C选项。

相关考题:

有以下程序#include stdio.h#include string.htypedef struct{ char name[9];char sex; float score[2]; } STU;STU f(STU a){ STU b={"Zhao",'m',85.0,90.0}; int i;strcpy(a.name,b.name);a.sex=b.sex;for(i=0;i2;i++) a.score[i]=b.score[i];return a;}main(){ STU c={"Qian",'f',95.0,92.0},d;d=f(c); printf("%s,%c,%2.0f,%2.0f\n",d.name,d.sex,d.score[0],d.score[1]);}程序的运行结果是A)Qian,f,95,92B)Qian,m,85,90C)Zhao,m,85,90D)Zhao,f,95,92

有以下程序#include stdio.hmain(){struct STU { char name[9]; char sex; double score[2];};struct STU a={"Zhao",'m',85.0,90.0},b={"Qian",'f',95.0,92.0};b=a;printf("%s,%c,%2.0f,%2.0f\n", b.name, b.sex, b.score[0], b.score[1]);}程序的运行结果是A)Qian,f,95,92B)Qian,m,85,90C) Zhao,f,95,92D)Zhao,m,85,90

有以下程序includeincludetypedef strtlct{char name[9];char sex;floatsc 有以下程序 #include <stdio.h> #include <string.h> typedef strtlct{ char name[9]; char sex;floatscore[2]; }STU; void f(STU A){ STU b={"Zhao",'m',85.0,90.0}; int i; strcpy(a.name,b.name); a.sex=b.sex; for(i=0;i<2;i++) a.score[i]=bA.Qian,f,95,92B.Qian,m,85,90C.Zhao,f,95,92D.Zhao,m,85,90

有下列程序:includeinclude "string.h"typedef struct{char name[9]; char sex;float 有下列程序: #include <stdio.h> #include "string.h" typedef struct{char name[9]; char sex;float score[2];}STU; void f(STU A) { STU b={"Zhao",'m',85.0,90.0}; int i; strcpy(a.name,b.name); a.sex=b.sex; for(i=0;i<2;i++) a.score[i]=b.score[i]; } main() { STU c={"Qian",'f',95.0,92.0}; f(C) ; printf("%s,%c,%2.0f,%2.0f\n",c.name,c.sex,c.score[0],c.score[1]); } 程序的运行结果是( )。A.Qian,f,95,92B.Qian,m,85,90C.Zhao,f,95,92D.Zhao,m, 85,90

有以下程序#include stdio.h#include string.htypedef struct{ char name[9]; char sex; float score[2]; }STU;void f(STU a){ STU b={"Zhao",′m′,850,900}; int i;strcpy(a.name,b.name);a.sex=b.sex;for(i=0;i2;i++) a.score[i]=b.score[i];}main(){ STU c={"Qian",′f′,95.0,92.0};f(c);printf("%s,%c,%2.0f,%2.0f\n",c.name,c.sex,c.score[0],c.score[1]);}程序的运行结果是A.Qian,f,95,92B.Qian,m,85,90C.Zhao,f,95,92D.Zhao,m,85,90

有以下程序 include include typedef struct { cha 有以下程序 #include <stdio.h> #include <string.h> typedef struct { char name[9]; char sex; float score[2]; } STU; STU f(STU a) { STU b={"Zhao", 'm', 85.0, 90.0}; int i; strcpy(a.name, b.name); a.sex = b.sex; for (i=0; i<2; i++) a.score[i] = b.score[i]; return a; } main() { STU c={"Qian", T, 95.0, 92.0}, d; d=f(c); printf("%s,%c,%2.0f,%2.0f\n", d.name, sex, score[O], d.score[1]); } 程序的运行结果是A.Qian, f,95,92B.Qian,m,85,90C.Zhao,m,85,90D.Zhao,f,95,92

有以下程序: #includestdio.h #includestring.h typedef struct{char name[9];char sex;int score[2];}STU; STU f(STU a) { STU b={"Zha0","m",85,90}; int i; strcpy(a.name,b.name); sex=b.sex; for(i=o;i2;i++)a.score[i]=b.score[i]; return a; } main( ) { STU c={"Qian",f,95,92),d; d=f(c); printf("%S,%C,%d,%d,",d.name,d.sex,d.score[0],d.score[l]); printf("%s,%c,%d,%d\n",C.name,C.sex,c.score[0],C.score[1]); } 程序运行后的输出结果是( )。A.Zhao,m,85,90,Qian,f,95,92B.Zhao,m,85,90,Zhao,m,85m90C.Qian,f,95,92,Qian,f,95,92D.Qian,f,95,92,zhan,m,85,90

有以下程序 include main() { struct STU{char name[9];char sex;double 有以下程序 #include <stdio.h> main() { struct STU{char name[9];char sex;double score[2];}; sturt STU a={"Zhao" ,'m',85.0,90.0},b={"Qian" ,'f,95:0,92.0}; b=a; printf("%s,%c,%2.0f,%2.0f\n",b.name,b.sex,b.score[0],b.score[1]); } 程序的运行结果是______。A.Qian,f,95,92B.Qian,85,90C.Zhao,f,95,92D.Zhao,m,85,90

有以下程序 #include stdio.h #include string.h typedef strlIct{char name[9];char sex;float score[2];}STU; STU f(STU a) { STU b={"Zhao",m,85.0,90.0);int i; strcpy(a name,b.name); sex:b.sex; for(i=0;i2;i++)a.score[i]=b.score[i]; return a; } main {STU c="Qian",f,95.0,92.0},d; d=f(c).printf("%s,%c,%2.0f,%2.0f",d.Name,d.sex,d.score[0],d.score[1]); } 程序的运行结果是( )。A.Qian,f,95,92B.Qian,m,85,90C.Zhao,m,85,90D.Zhao,f,95,92

有以下程序: #includestdio.h struct STU{char name[9];char sex;int score[2];}; void f(struct STU a[]) { struct STU b={"Zhao",m,85,90); a[1]=b; } main( ) { struct STU c[2]={{"Qian",f,95,92},{"Sun",m 98,99}}; f(c); printf(”%s,%c,%d,%d,¨,c[o].name,c[o].sex,c[o].score[o],c[o].score[1]); printf("%s,%c,%d,%d\n",c[1].name,c[1].sex,c[1].score[o],c[1].score [1]); } 程序运行后的输出结果是( )。A.Zhao,m,85,90,Sun,m,98,99B.Zhao,m,85,90,Qian,f,95,92C.Qian,f,95,92,Sun,m,98,99D.Qian,f,95,92,Zhao,m,85,90

有以下程序#includestdio.h#includesiring.htypedef struct{char name[9];char sex;int score [2];}STU;STU f(STU a){ STU b={"Zhao",'m',85,90);int i;strcpy(a.name,b.name);a.sex=b.sex:for(i=0;i2;i++) a.score [i]=b.score[i];return a;}main()STU c={"Qian",'f',95,92},d;d=f(c):printf("%s,%c,%d,%d,",d.name,d.sex,d.score[0],d.score[1]);prinff("%s,%c,%d,%d\n",c.name,c.sex,c.score[0],c.score[1]);}程序运行后的输出结果是A.Zhao,m,85,90,Qian,f,95,92B.Zhao,m,85,90,Zhao,m,85,90C.Qian,f,95,92,Qian,f,95,92D.Qian,f,95,92,Zhao,m,85,90

有以下程序 include include typedef stmct{ char name[9];char sex;flo 有以下程序#include <stdio.h>#include <string.h>typedef stmct{ char name[9];char sex;float score[2];}STU;void f(STU a){ STU b={"Zhao",'m',85.0,90.0}; int i;strcpy(a.name,b.name) ;a.sex=b.sex;for(i=0;i<2;i++) a.score[i]=b.score[i];main( ){ STU c={"Qian",'f',95.0,92.0};f(c);printf("%s,%c,%2.0f,%2.0f\n",c.name,c.sex,c.score[0],c.score[1]) ;}程序的运行结果是A.Qian,f,95,92B.Qian,m,85,90C.Zhao,f,95,92D.Zhao,m,85,90

有以下程序:includeincludetypedef struct{char name[9];char sex;float s 有以下程序: #include <stdio.h> #include <string.h> typedef struct{char name[9];char sex;float score[2]}STU; STU f(STU A) {STU b={"Zhao",'m',85.0,90.0}; int i; strcpy(a.name,b.namC) ; a.sex=b.sex; for(i=0;i<2;i++) a.score[i]=b.score[i]; return a; } main() {STU c={"Qian",'f',95.0,92.0},d; d=f(C) ; pintf("%s,%c,%2.of.%2.of\n",d.name,d.sex,d.score[0],score[1]); } 程序的运行结果是( )。A.Qian,f,95,92B.Qian,m,85,90C.Zhao,m,85,90D.Zhao,C95,92

有以下程序#includestdio.h#includestring.htypedef struct {char name[9]; char sex; float score[2];}STU;STU f(STUA.{STU b={“Zhao”,’m’,85.0,90.0}; int I;strcpy(a.name,b.name);a.sex=b.sex;for(i=0;i2;i++) a.score=b.score;return a;}main(){STU c={“Qian”,’f’,95.0,92.0},d;d=f(C.;printf(“%s,%c,%2.0f,%2.0f\n”,d.name,d.sex,d.score[0], d.score[1]);}程序的运行结果是( )。A. Qian,f,95,92B.Qian,m,85,90C.Zhao,m,85,90D.Zhao,f,95,92

试题36有以下程序#include stdio.h#include string.hTypedef struct {char name[9]; char sex; int score[2];}STU;STU f(STU a){ STU b={“Zhao”, ‘m’, 85, 90};int i ;strcpy(a.name, b.name);a.sex=b.sex;for(i=0; i2; i++) a.score[i]=b.score[i];return a;}main(){STU c={“Qian”, ‘f’, 95, 92},d;d=f(c);printf(“%s, %c, %d, %d,”, d.name, d.sex, d.score[0], d.score[1]);printf(“%s, %c, %d, %d\n”, c.name, c.sex, c.score[0], c.score[1]);}程序运行后的输出结果是()A.Zhao, m, 85,90, Qian, f, 95, 92B.Zhao, m, 85,90, Zhao, m, 85, 90C.Qian, f, 85,90, Qian, f, 95, 92D.Qian, f, 95, 92, Zhao, m, 85, 90

单选题有以下程序#include #include typedef struct{ char name[9]; char sex; float score[2];} STU;STU f(STU a){ STU b={zhao,'m',85.0,90.0}; int i; strcpy(a.name, b.name); a.sex = b.sex; for(i=0; i2; i++) a.score[i]=b.score[i]; return a;}main(){ STU c={Qian,'f',95.0,92.0},d; d=f(c); printf(%s,%c,%2.0f,%2.0f, d.name, d.sex, d.score[0], d.score[1]);}程序的运行结果是(  )。AQian,m,85,90BZhao,m,85,90CQian,f,95,92DZhao,f,95,92

单选题有以下程序:#include struct STU{ char name[9]; char sex; int score[2];};void f(struct STU a[]){ struct STU b={zhao,'m',85,90}; a[1]=b;}main(){ struct STU c[2] = {{Qian,'f',95,92}, {Qian,'f',95,92}}; f(c); printf(%s,%c,%d,%d,, c[0].name, c[0].sex, c[0].score[0], c[0].score[1]); printf(%s,%c,%d,%d, c[1].name, c[1].sex, c[1].score[0], c[1].score[1]);}程序运行后的结果是(  )。AZhao,m,85,90,Sun,m,98,99BZhao,m,85,90,Qian,f,95,92CQian,f,95,92,Sun,m,98,99DQian,f,95,92,Zhao,m,85,90

单选题若有以下程序#include typedef struct stu{ char name[10],gender; int score; } STU;void f(STU a, STU b){ b = a; printf(%s,%c,%d,, b.name, b.gender, b.score);}main(){ STU a={Zhao, 'm', 290}, b={Qian, 'f', 350}; f(a,b); printf(%s,%c,%d, b.name, b.gender, b.score);}则程序的输出结果是(  )。AZhao,m,290,Qian,f,350BZhao,m,290,Zhao,m,290CQian,f,350,Qian,f,350DZhao,m,290,Zhao,f,350

单选题有以下程序:#include #include typedef struct{ char name[9]; char sex; float score[2];} STU;void f(STU a){ STU b={zhao,'m',85.0,90.0}; int i; strcpy(a.name, b.name); a.sex = b.sex; for(i=0; i2; i++) a.score[i]=b.score[i];}main(){ STU c={Qian,'f',95.0, 92.0}; f(c); printf(%s,%c,%2.0f,%2.0f, c.name, c.sex, c.score[0], c.score[1]);}程序的运行结果是(  )。AQian,f,95,92BQian,m,85,90CZhao,f,95,92DZhao,m,85,90

单选题有以下程序:#include #include typedef struct stu{ char name[10]; char gender; int score;}STU;void f(char *name, char *gender, int *score){ strcpy(name,Qian); *gender='f'; *score=350;}main(){ STU a={Zhao,'m',290},b; b=a; f(b.name,b.gender,b.score); printf(%s,%c,%d,, a.name, a.gender, a.score); printf(%s,%c,%d, b.name, b.gender, b.score);}程序运行后的输出结果是(  )。AZhao,m,290,Qian,f,350BQian,m,290,Zhao,m,290CZhao,m,290,Zhao,m,290DZhao,m,290,Qian,m,290

单选题若有以下程序#include #include #include typedef struct stu{ char *name,gender; int score;}STU;void f(char *p){ p=(char *)malloc(10); strcpy(p,Qian);}main(){ STU a={NULL,'m',290},b; a.name=(char *)malloc(10); strcpy(a.name,Zhao); b=a; f(b.name); b.gender='f'; b.score=350; printf(%s,%c,%d,, a.name, a.gender, a.score); printf(%s,%c,%d, b.name, b.gender, b.score);}则程序的输出结果是(  )。AQian,m,290,Qian,f,350BZhao,m,290,Qian,f,350CQian,f,350,Qian,t,350DZhao,m,290,Zhao,f,350

单选题有以下程序:#include #include typedef struct stu{ char name[10]; char gender; int score;}STU;void f(char *name,char gender,int score){ strcpy(name,Qian); gender='f'; score=350;}main(){ STU a={Zhao,'m',290},b; b=a; f(b.name,b.gender,b.score); printf(%s,%c,%d,, a.name, a.gender, a.score); printf(%s,%c,%d, b.name, b.gender, b.score);}程序的运行结果是(  )。AZhao,m,290,Qian,m,290BZhao,m,290,Zhao,m,290CZhao,m,290,Qian,m,350DZhao,m,290,Qian,f,350

单选题有以下程序:#include typedef struct stu{ char name[10]; char gender; int score; } STU;void f(STU *a, STU *b){ *b = *a; printf(%s,%c,%d,, b-name, b-gender, b-score);}main(){ STU a={Zhao, 'm', 290}, b={Qian, 'f', 350}; f(a,b); printf(%s,%c,%d, b.name, b.gender, b.score);}程序的运行结果是(  )。AZhao,m,290,Zhao,m,290BZhao,in,290,Qian,f,350CQian,f,350,Qian,f,350DQian,f,350,Zhao,m,290

单选题有以下程序#include #include typedef struct{ char name[9]; char sex; int score[2];} STU;STU f(STU a){ STU b={zhao,'m',85,90}; int i; strcpy(a.name, b.name); a.sex = b.sex; for(i=0; i2; i++) a.score[i]=b.score[i]; return a;}main(){ STU c={Qian,'f',95,92},d; d=f(c); printf(%s,%c,%d,%d,, d.name, d.sex, d.score[0], d.score[1]); printf(%s,%c,%d,%d, c.name, c.sex, c.score[0], c.score[1]);}程序运行后的输出结果是(  )。AZhao,m,85,90,Qian,f,95,92BZhao,m,85,90,Zhao,m,85,90CQian,f,95,92,Qian,f,95,92DQian,f,95,92,Zhao,m,85,90

单选题有以下程序:#include typedef struct stu{ char name[10]; char gender; int score; } STU;void f(STU a, STU *b){ a = *b; printf(%s,%c,%d,, a.name, a.gender, a.score);}main(){ STU a={Zhao, 'm', 290}, b={Qian, 'f', 350}; f(a,b); printf(%s,%c,%d, a.name, a.gender, a.score);}程序运行后的输出结果是(  )。AQian,f,350,Qian,f,350BZhao,m,290,Qian,f,350CQian,f,350,Zhao,m,290DZhao,m,290,Zhao,m,290

单选题有以下程序:#include main(){ struct STU {  char name[9];  char sex;  double score[2]; }; struct STU a = {Zhao,'m',85.0,90.0}, b={Qian,'f',95.0,92.0}; b=a; printf(%s,%c,%2.0f,%2.0f, b.name, b.sex, b.score[0], b.score[1]);}程序运行的结果是(  )。AQian,f,95,92BQian,f,85,90CZhao,f,95,92DZhao,m,85,90

单选题有以下程序:#include #include typedef struct stu{ char name[10]; char gender; int score;}STU;void f(STU *c){ strcpy(c-name,Qian); c-gender='f'; c-score=350;}main(){ STU a={Zhao,'m',290},b; b=a; f(b); printf(%s,%c,%d,, a.name, a.gender, a.score); printf(%s,%c,%d, b.name, b.gender, b.score);}程序运行后的输出结果是(  )。AZhao,m,290,Qian,f,350BZhao,m,290,Qian,m,290CZhao,m,290,Zhao,m,290DZhao,m,290,Qian,m,350