题目内容

有程序如下定义,输出结果_______________。#include struct info{ int k; char *s; }t;void f(struct info t){ t.k=2022;t.s="Borland";}void main(void) { t.k=2021;t.s="Inprise";f(t);printf("%d,%s\n",t.k,t.s);}

查看答案
更多问题

设计一个共用体,顺序给共用体成员赋值,输出结果为____ ,____ ,____,____ 。#include union numb{ int a;char ch;float f; };int main(void){ union numb un1;un1.a=1;un1.ch='B';un1.f=10;printf("%.2f ",un1.f);un1.a=1;printf("%d ",un1.a);un1.ch='B';printf("%d %c",un1.a,un1.ch);}

定义一个枚举类型,下面的程序段输出____。#include enum TLight{ green=1, red,yellow=0};int main(void){ enum TLight light;light=red;printf("%d ", light);light=yellow;printf("%d ", light);}

有程序如下定义,输出结果为____。struct NODE{ char num;struct NODE *next;};void 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=a; q->num=b; r->num=c;r->next=q;q->next=p;p->next=NULL;printf("%c\n",r->next->next->num);}

有如下程序,若文本文件mf1.dat中原有内容为ABC,则运行程序后文件mf1.dat中的内容为( )。#include#includevoid main(){FILE *fp1;fp1=fopen("mf1.txt","w");if (fp1 == NULL){ printf("cannot open the file.\n");exit(0);}fprintf(fp1,"abc");fclose(fp1);}

答案查题题库