单选题有如下程序:#include #include struct S{ char name[10];};void change(struct S *data,int value){ strcpy(data-name, ****); value=13;}main(){ struct S input; int num = 4; strcpy(input.name, THIS); change(input,num); printf(%s,%d,input.name,num);}程序运行后的输出结果是(  )。A****,4B****,13CTHIS,4DTHIS,13

单选题
有如下程序:#include #include struct S{ char name[10];};void change(struct S *data,int value){ strcpy(data->name, ****); value=13;}main(){ struct S input; int num = 4; strcpy(input.name, THIS); change(&input,num); printf(%s,%d,input.name,num);}程序运行后的输出结果是(  )。
A

****,4

B

****,13

C

THIS,4

D

THIS,13


参考解析

解析:
程序执行过程为:定义结构体变量input,调用strcpy(input.name, "THIS"),使input.name = "THIS",调用函数change(&input,4),将结构体地址传入函数,执行函数体,调用strcpy(data->name, "****")使input.name = "****",而4是值传递,并没有改变num的值。答案选择A选项。

相关考题:

有以下程序#include stdio.htypedef struct{ int num;double s ; }REC;void fun1( REC x ){x.num=23; x.s=88.5;}main(){ REC a={16,90.0 };fun1(a);printf("%d\n",a.num);}程序运行后的输出结果是 【 1 4 】 。

有以下程序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

有以下程序 struct STU { char name[10]; int num; float TotalScore; }; vold f(struct STU *p) { struct STU s[2]={{"SunDan",20044,550),{"Penghua".20045,537}},*q=s ++p; ++q; *p=*q; } main() { struct SrU s[3]={{"YangSan",20041,703),{"LiSiGuo",20042,580}}; f(s); printf("%s %d %3.of\n",S[1].name,s[1].num,s[1].Totalscore); } 程序运行后的输出结果是A.SunDan 20044 550B.Penghua 20045 537C.USiGuo 20042 580D.SunDan 20041 703

有以下程序 include typedef struct { int num;double s; }REC; void funl(REC *x) { x 有以下程序 include<stdio.h> typedef struct { int num;double s; }REC; void funl(REC *x) { x->num=23;x->s=88.5; } void main() { REC a={16,90.0}; fun1(A); printf("%d\n",a.num); } 程序运行后的输出结果是( )。

有以下程序: struct STU { char name[10]; int num; float TotalScore; }; void f(struct STU *p) { struct STU s[2]={{"SunDan", 20044, 550}, {"Penghua", 20045, 537}}, *q=s; ++p; ++q; *p=*q; } main() { struct STU s[3]={{"YangSan", 20041, 703}, {"LiSiGuo", 20042, 580}}; f(s); printf(" % s % d % 3.0f\n", s[1]. name, s[1]. num, s[1]. TotalScore); } 程序运行后的输出结果是______。A.SunDan 20044 580B.Penghua 20045 537C.LiSiGUO 20042 580D.SunDan 20041 703

有以下程序:include struet STU{charname[10]; int num; float TotalSeore; };void f( 有以下程序:#include <stdio.h>struet STU{ charname[10]; int num; float TotalSeore; };void f(struet STU * p){ struet STU s [2] = { { "SunDan" ,20044,550 } , { "Penghua" ,20045,537 } } , * q = s; ++p; ++q; *p= *q;}main( ){ struct STU s[3] = { { "YangSan" ,20041,703 }, { "LiSiGuo" ,20042,580} }; f(s) ;printf("% s % d % 3.Of\n" ,s [1]. name, s [1]. num ,s [1]. TotalScore);}程序运行后的输出结果是( )。A.SunDan 20044 550B.Penghua 20045 537C.LiSiGuo 20042 580D.SunDan 20041 703

有以下程序: include struct STU {int num; float TotalScore; 有以下程序: #include <strino.h> struct STU {int num; float TotalScore; }; void f(struct STU p) {struct STU s[2]={{20044,550},{20045,537}}; p.num=s[1].num;p.TotalScore=s[1].TotalScore; } main() {struct STU s[2]={{20041,703},{20042,580}}; f(s[0]); printf("%d%3.0t\n",s[0].num,s[0].TotalScore); } 程序运行后的输出结果是 ______。A.20045 537B.20044 550C.20042 580D.20041 703

有以下程序: 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

下列程序的运行结果为【】。 include include {int a; char b[10]; double c;}; 下列程序的运行结果为【 】。include<stdio.h>include<string.h>{ int a; char b[10]; double c; };void f (struct A *t);main(){ struct A a={1001,"ZhangDa",1098.0};f(a) ; printf("%d,%s,%6.lf\n",a.a,a.b,a.C);}void f(struct A*t){ strcpy(t->b, "ChangRong");}

有以下程序#include string.hstruct STU{ int num; float TotalScore; };void f(struct STU p){ struct STU s[2]={{1047,530},{1048,531}}; p.num = s[1].num; p.TotalScore = s[1].TotalScore;}main(){ struct STU s[2]={{2041,730},{2042,731}}; f(s[0]); printf("%d,%3.0f\n",s[0].num,s[0].TotalScore);}程序的运行结果是A.1047,530 B.1048,531C.2041,730 D.2042,731

有以下程序 include struct NODE {int num;stmct NODE*next;}; main() { struct NODE 有以下程序#include<stdlib.h>struct NODE{ int num;stmct NODE*next;};main(){ struct NODE*p,*q,*r;p=(struct NODE*)malloc(sizeof(struct NODE));q=(struct NODE*)malloc(sizeof(struct NODE));r=(struct NODE*)malloc(sizeof(struct NODE));p->num=10;q->num=20;r->num=30;p->next=q;q->next=r;printf(“%d\n”,p->num+q->next->num);}程序运行后的输出结果是A.10B.20C.30D.40

有以下程序#include stdio.hstruct stu{ int num; char name [10];int age;};Void fun(struct stu *p){ printf("%s\n,p-name);}main( ){ struct stu x[3]={ {01,”Zhang”,20},{02, ” Wang”,19},{03, ”zhao”,18} };fun(x+2);}程序运行后的输出结果是A)ZhangB)ZhaoC)WangD)19

有以下程序 include struct NODE{ int num; struct NODE *next;}; main( ) 有以下程序#include <stdlib.h>struct NODE{int num;struct NODE *next;};main( ){ struct NODE *p,*q,*r;int sum=0;p=(struct NODE *)malloc(sizeof(struct NODE));q=(struct NODE *)malloc(sizeof(struct NODE));r=(struct NODE *)malloc(sizeof(struct NODE));p->num=1;q->num=2;r->num=3;p->next=q;q->next=r;r->next=NULL;sum+=q->next->num;sum+=p->num;printf(“%d\n”,sum);}执行后的输出结果是A.3B.4C.5D.6

有以下程序: include struct NODE { int num; struct NODE*next; }; main() { struct 有以下程序:#include <stdlib.h>struct NODE{ int num; struct NODE *next; };main(){ struct NODE *p,*q,*r;p=(struct NODE*)malloc(sizeof(struct NODE));q=(struct NODE*)mallloc(sizeof(struct NODE));r=(struct NODE*)malloc(sizeof(struct NODE));p->num=10;q->num=20; r->num=30;p->next=q;q->next=r;printf("%d\n",p->num+q->next->num);}程序运行后的输出结果是( )。A.10B.20C.30D.40

有以下程序: #includestdio.h struct stu { int num; char name[10]: int age;} void fun(struct stu*p) {printf("%s\n",(*p).name);} the main { struct stu students[3]={{9801,"Zhang".20}, {9802,"Wang",19},{9803,"Zhao",1 8}} fun(students+2); } 输出的结果是( )。A. ZhangB.ZhaoC.WangD.18

以下程序的输出结果是______。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

有以下程序: include struct NODE {int num;stmct NODE *next;}; main( ) { str 有以下程序:#include<stdlib.h>struct NODE{ int num;stmct NODE *next;};main( ){ struct NODE * p, * q,* r;p=(struct NODE * )malloc(sizeof(struct NODE) );q=(struct NODE * )malloc(sizeof(struct NODE) );r=(struct NODE * )malloc(sizeof(struct NODE) );p->num=10; q->num=20; r->num=30;p->next=q; q->next=r;printf("%d\n",p->num+q->next->num);}程序运行后的输出结果是A.10B.20C.30D.40

有以下程序:include struct STU{char name[10]; int num;};void f1(struct STU c){ st 有以下程序: #include <stdio.h> struct 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={"SanDan",2044}; *c=b; } main() { struct STU a={"YangSan",2041}, b={"WangYin",2043}; f1(a); f2(b); printf("%d%d\n",a.num,b.hum); } 执行后的输出结果是( )。A.2041 2044B.2041 2043C.2042 2044D.2042 2043

有以下程序 include struct NODE {int num;struct NODE*next;} main() {struct NODE 有以下程序#include<stdlib.h>struct NODE{int num;struct NODE*next;}main(){struct NODE *P,*q,*r;p=(struct NODE *)malloc(sizeof(struct NODE));q=(struct NODE *)malloc(sizeof(struet NODE));r=(struct NODE*)malloc(sizeof(struct NODE)):p->num=10;q->num=20;r->num=30;p->next=q;q->next=r;printf("%d\n",p->num+q->next->num):}程序运行后的输出结果是( )A.10B.20C.30D.40

有以下程序 include struct STU { char num[10]; float score[3];}; void ma 有以下程序 #include<iostream.h> struct STU { char num[10]; float score[3];}; void main( ) { struct STU s[3]={ { "20021",90,95,85 }, {"20022",95,80,75 }, {"20023",100,95,90 } },* p=s; int i; float sum=0; for(i=0;i<A.260B.270C.280D.285

有以下程序:include include struet STU{ int nam;float TotalSeore;};v 有以下程序:#include <stdio, h>#include <string, h>struet STU{ int nam; float TotalSeore;};void f( strnct STU p){ struct STU s[2] = { {20044,550} ,{20045,537} }; p.num = s [1]. num; p.TotalScore = s [1]. TotalScore;main( ){ struct STU s[2] = {{20041,703} ,{20042,580}}; f(s[0] ); printf( "%d %3.Of\n" ,s[0].num,s[0].TotalSeore); }程序运行后的输出结果是( )。A.20045 537B.20044 550C.20042 580D.20041 703

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

单选题有以下程序:#include struct STU{ int num; float TotalScore;};void f(struct STU p){ struct STU s[2] = {{20044,550}, {20045,537}}; p.num = s[1].num; p.TotalScore = s[1].TotalScore;}main(){ struct STU s[2] = {{20041,703}, {20042,580}}; f(s[0]); printf(%d %3.0f, s[0].num, s[0].TotalScore);}程序运行后的输出结果是(  )。A20045 537B20044 550C20042 580D20041 703

单选题有以下函数:#include struct stu{ int num; char name[10]; int age;};void fun(struct stu *p){ printf(%s, p-name);}main(){ struct stu x[3] = {{01,Zhang,20}, {02,Wang,19}, {03,Zhao,18}}; fun(x+2);}程序运行后的输出结果是(  )。AZhangBZhaoCWangD19

单选题有以下程序#include #include struct S{ char name[10];};void change(struct S *data, int value){ strcpy(data-name, #); value = 6;}main(){ struct S input;  int num = 3; strcpy(input.name, OK); change(input, num); printf(%s,%d, input.name, num);}程序运行后的输出结果是(  )。AOK,6B#,6COK,3D#,3

单选题有以下程序:#include #include struct S{ char name[10];};main(){ struct S s1,s2; strcpy(s1.name,12345); strcpy(s2.name,ABC); s1=s2; printf(%s,s1.name);}程序运行后的输出结果是(  )。AABC12BABC45C12345DABC

单选题有以下程序:#include #include struct S{ char name[10];};main(){ struct S s1,s2; strcpy(s1.name,XXX); strcpy(s2.name,=); s1=s2; printf(%s,s1.name);}程序运行后的输出结果是(  )。A=BXXXC=XXDX=