计算机二级C语言程序设计
VIP题库
设有以下程序段struct person{char name[10];char sex;float weight;}zhangsan, *ptr;ptr = &zhangsan;若要从键盘读入姓名给结构体变量zhangsan的name成员,输入项错误的是______。
设有如下定义:struct ss{ char name[10];int age;char sex;} std[3],*p=std;下面各输入语句中错误的是______。
若有以下定义和语句struct st{ int n; struct st *next; };struct st a[3] = { 5,&a[0], 6,&a[1], 7,&a[2] }, *p;p=&a[0];则值为6的表达式是(提示:运算符->的优先级高于++)______。
设有如下的说明和定义struct {int a;char *s;} x, *p = &x;x.a = 4;x.s = "hello";则以下叙述中正确的是______。
设有以下说明语句struct ex{ int x; float y;char z; } example;则下面的叙述中不正确的是______。
设有以下定义union data{ int d1;float d2;} demo;则下面叙述中错误的是______。
若有以下程序 #include typedef struct stu { char name[10], 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); }则程序的输出结果是______。
程序中若有以下的说明定义和语句#include #include struct STR{ char num[10]; int s; };main(){ struct STR t, *p;p=&t;┇}则不能给变量t的s成员赋整数99,给num成员赋空串的语句组是______。
有以下程序#include #include typedef struct stu {char name[10];char gender;int score; } STU;void f(char *name, char gender, int score){ strcpy(name, "Qian");gender = ''f'';score = 350;}main(){ STU a={"Zhao", ''m'', 290}, b;b=a;f(b.name,b.gender,b.score);printf("%s,%c,%d,", a.name, a.gender, a.score);printf("%s,%c,%d\n", b.name, b.gender, b.score);}程序的运行结果是______。
以下程序的功能是:建立一个带有头结点的单向链表,并将存储在数组中的字符依次转储到链表的各个结点中,请为下划线处有号码的选择出正确的选项。#include stuct node{ char data; struct node *next;};______CreatList(char *s){ struct node *h,*p,*q);h=(struct node *) malloc(sizeof(struct node));p=q=h;while(*s!=''\0''){ p=(struct node *) malloc(sizeof(struct node));p->data=______;q->next=p;q=___(50)___;s++;}p->next=''\0'';return h;}main(){ char str[]="link list";struct node *head;head=CreatList(str);...}
«
1
2
...
7
8
9
10
11
12
13
...
149
150
»