有程序如下定义,输出结果为____。#include struct info{ int x,float y;char z} st={10,10.0,'a’};void main( ){ struct st *pa=&st;printf(“%d ”,s.x);printf(“%c “,p->z);printf(“%.2f “,(*p)->y);}
查看答案
有程序如下定义,输出结果_______________。#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);}