[单选题]

有以下程序

#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′,850,900}; 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,92

B.Qian,m,85,90

C.Zhao,f,95,92

D.Zhao,m,85,90

参考答案与解析:

相关试题

有以下程序 #include<stdio.h> #include<string.

[单选题]有以下程序#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′,850,900}; int i;strcpy(a.name,b.name);a.sex=b.sex;for(i=0;i<2;i++) a.score[i]=b.score[i];}main(){

  • 查看答案
  • 有以下程序 #include<stdio.h> #include<string.

    [单选题]有以下程序#include <stdio.h>#include <string.h>void fun(char *s[],int n){ char *t; int i,j;for(i=0;i<n-1;i++)for(j=i+1;j<n;j++)if(strlen(s[i])>strlen(s[j])) {t=s[i];s[i]:s[j];s[j]=t;}}main(){ char *ss[]={"bcc","bbcc","xy","a

  • 查看答案
  • 有以下程序 #include<stdio.h> #include<string.

    [单选题]有以下程序#include <stdio.h>#include <string.h>void fun(char *s[],int n){ char *t; int i,j;for(i=0;i<n-1;i++)for(j=i+1;j<n;j++)if(strlen(s[i])>strlen(s[j])) {t=s[i];s[i]:s[j];s[j]=t;}}main(){ char *ss[]={"bcc","bbcc","xy","a

  • 查看答案
  • 有以下程序 #include<stdio.h>#include<string.h

    [单选题]有以下程序#include <stdio.h>#include <string.h>void fun(char s[][10],int n){char t; int i,j;for(i=0;i<n-1;i++)for(j=i+1;j<n;j++)/*比较字符串的首字符大小 ,并交换字符串的首字符*/if(s[i][0]<s[j][0]) {t=s[i][0];s[i][0]=s[j][0];s[j][0]=t;}}main(){char ss[5][10

  • 查看答案
  • 有以下程序 #include<stdio.h>#include<string.h

    [单选题]有以下程序#include<stdio.h>#include<string.h>typedef 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;i<2;i++) a.score=b.score;return a;}main(){STU

  • 查看答案
  • 有以下程序:include<stdio.h> include<string.h>

    [单选题]有以下程序:include<stdio.h> include<string.h>main{ char x[]="STRING"有以下程序:include<stdio.h>include<string.h>main{ char x[]="STRING";x[0]=0;x[1]=/0;x[2]=0;printf("%d %d/n",sizeof(x),strlen(x));}程序运行后的输出结果

  • 查看答案
  • 有以下程序#include<stdio.h>#include<string.h>

    [单选题]有以下程序#include<stdio.h>#include<string.h>struet A{int a;char b[10];double c;};struct A f(struct A t);main( ){struct A a={1001,“ZhangDa”,1098.0);a=f(A);prinff(“%d,%S,%6.1f\n”,a.a,a.b,a.e);}struct A f(struct A t){t.a=1002;strepy(t.b,“changRo

  • 查看答案
  • 有以下程序#include<stdio.h>#include<string.h>

    [单选题]有以下程序#include<stdio.h>#include<string.h>main( ){char a[10]=”abcd”;prinff(“%d,%d\n”,strlen(A),sizeof(A));}程序运行后的输出结果是A.7,4B.4,10C.8,8D.10,lO

  • 查看答案
  • 有以下程序#include<stdio.h>#include<string.h>

    [单选题]有以下程序#include<stdio.h>#include<string.h>main( ){char str[][20]={“Qne*World”,“one*Dream!”},*P=str[1 ].prinff(“%d,”,strlen(p));printf(“%s\n”,P); ’}程序运行后的输出结果是A.9,One*World S)9,One*Dream!B.10,One*Dream!C.10,One*World

  • 查看答案
  • 有以下程序#include<stdio.h>#include<string.h>

    [单选题]有以下程序#include<stdio.h>#include<string.h>main( ){char x[]=“STRING”;x[0]=0;x[1]=’\0’;x[2]=’0’;printf(”%d%d\n”,sizeof(x),strlen(x));}程序运行后的输出结果是( )。A.6 1B.7 0C.6 3D.7 1

  • 查看答案
  • 有以下程序 #include<stdio.h> #include<string.