计算机二级C语言程序设计
VIP题库
下面结构体的定义语句中,错误的是______。
若程序中有以下的说明和定义:struct abc{int x;char y;}struct abc s1,s2;则会发生的情况是______。
有以下程序#include #include typedef struct{ char name[9]; char sex; float score[2]; } STU;void f(STU a){ STU b={"Zhao",''m'',85.0,90.0}; int i;strcpy(a.name,b.name);a.sex=b.sex;for(i=0;i
有以下程序#include struct NODE{int num;struct NODE *next;};main(){ struct NODE *p,*q,*r;int sum=0;p=(struct NODE *)malloc(sizeof(struct NODE));q=(struct NODE *)malloc(sizeof(struct NODE));r=(struct NODE *)malloc(sizeof(struct NODE));p->num=1;q->num=2;r->num=3;p->next=q;q->next=r;r->next=NULL;sum+=q->next->num;sum+=p->num;printf("%d\n",sum);}执行后输出结果是______。
有以下结构体说明、变量定义和赋值语句struct STD{ char name[10];int age;char sex;}s[5],*ps;ps=&s[0];则以下scanf函数调用语句中错误引用结构体变量成员的是______。
设有如下语句typedef struct Date{int year;int month;int day;} DATE;则以下叙述中错误的是______。
以下程序的输出结果是______。union myun{ struct{ int x,y,z;}u;int k;}a;main(){ a.u.x=4;a.u.y=5;a.u.z=6;a.k=0;printf("%d\n",a.u.x);}
设有定义:struct { int n; float x;} s[2],m[2]={{10,2.8},{0,0.0}};则以下赋值语句中正确的是______。
有以下程序#include struct ball{char color[10];int dim;};main(){struct ball list[2] = {{"white", 2}, {"yellow", 3}};printf("%s:%d\n", (list+1)->color, list->dim);}程序运行后的输出结果是______。
有以下程序#include typedef struct stu {char name[10];char gender;int score; } STU;void f(STU a, STU *b){ *b = a;printf("%s,%c,%d,", b->name, b->gender, b->score);}main(){ STU a={"Zhao", ''m'', 290}, b={"Qian", ''f'', 350};f(a,&b);printf("%s,%c,%d\n", b.name, b.gender, b.score);}程序运行后的输出结果是______。
«
1
2
3
4
5
6
7
8
...
149
150
»