C语言读程序写结果练习题
6、
7、
8、 int k; } a; voidmain() { a.u.x=4; a.u.y=5; a.u.z=6; a.k=0; printf("%d\n",a.u.x); } #include <stdio.h> struct STU { charnum[10]; float score[3]; }; voidmain() { structSTU 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<3;i++) sum=sum+p->score[i]; printf(“%6.2f\n”,sum); } #include <stdio.h> #include <stdlib.h> struct NODE { intnum; struct NODE *next; }; voidmain() { 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); }
C语言读程序写结果练习题
typedef union student { char name[10]; longsno; char sex; float score[4]; }STU; voidmain() { STU a[5]; printf(“%d\n”,sizeof(a)); }
1、 6
2、 Zhao
3、 04515
4、 51, 60, 21
5、 0
6、 270.00
7、 40
8、 80