题目内容

若有以下程序 #include<stdio.h> #include<stdlib.h> #include<string.h> 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\n",b.name,b.gender,b.score); 则程序的输出结果是______。

A. Zhao,m,290,Zhao,f,350
B. Zhao,m,290,Qian,f,350
C. Qian,f,350,Qian,f,350
D. Qian,m,290,Qian,f,350

查看答案
更多问题

有以下程序 #include<stdio.h> main() FILE*fp;char str[10]; fp=fopen("myfile.dat","w"); fputs("abe",fp); fclose(fp); fp=fopen("myfile.dat","a+t"); fprintf(fp,"%d",28); rewind(fp); fscanf(fp,"%s",str); puts(str); fclose(fp); 程序运行后的输出结果是______。

A. abe28
B. 28c
C. abc
D. 因类型不一致而出错

有以下程序 #include<stdio.h> main() FILE *f; f=fopen("filea.txt","w"); fprintf(f,"abc"); fclose(f); 若文本文件filea.txt中原有内容为:hello,则运行以上程序后,文件filea.txt中的内容为

A. abc
B. abclo
C. helloabc
D. abchcllo

下面结构体的定义语句中,错误的是______。

A. struct ordint x;int y;int z;struct ord a;
B. struct ordint x;int y;int z;;struct ord a;
C. struct ord int x;int y;int z;a;
D. streetint x;int y;int z;)a;

有以下程序 #include<stdio.h> #define N 2 #define M N+1 #define NUM(M+1)*M/2 main() printf("%d\n",NUM); 程序运行后的输出结果是______。

A. 8
B. 4
C. 9
D. 6

答案查题题库