笔果题库
计算机二级C语言程序设计
VIP题库
搜题找答案,就上笔果题库
有以下程序#include struct ord{ int x,y;} dt[2]={1,2,3,4};main(){struct ord *p=dt;printf("%d,",++(p->x));printf("%d\n",++(p->y));}程序运行后的输出结果是______。
搜题找答案,就上笔果题库
有以下结构体说明和变量定义,如下图所示,指针p、q、r分别指向一个链表中的三个连续结点。struct node{ int data;struct node *next;}*p,*q,*r;data next data next data next┌─┬─┐ ┌─┬─┐ ┌─┬─┐─→│ │ ┼→│ │ ┼→│ │ ┼→ └─┴─┘ └─┴─┘ └─┴─┘ ↑p ↑q ↑r现要将q和r所指结点的先后位置交换,同时要保持链表的连续,以下错误的程序段是______。
搜题找答案,就上笔果题库
设有定义:struct {char mark[12];int num1;double num2;} t1,t2;,若变量均已正确赋初值,则以下语句中错误的是______。
搜题找答案,就上笔果题库
以下程序的输出结果是______。main(){union { char i[2];int k;} r;r.i[0]=2;r.i[1]=0;printf("%d\n",r.k);}
搜题找答案,就上笔果题库
设有如下说明typedef struct{int n;char c;double x;}STD;则以下选项中,能正确定义结构体数组并赋初值的语句是______。
搜题找答案,就上笔果题库
有以下程序#includetypedef struct book{char name[50];double price;} BOOK;void fun (BOOK*pd,int num, int size);void main(){BOOK data[10] = {"photoshop",26.8,"计算机原理",15.00, "数据结构",35.6};int n=3, m=10;fun (data, n, m);printf ("%s",%s\n",data [8].name, data[9].name);}void fun(B00K*pd, int num, int size){int i,j, t;double mx, mn;mx=mn=pd[0].price;j=t=0;for(i=1;imx){mx=pd[i].price;j=i;}if(pd[i].price
搜题找答案,就上笔果题库
以下叙述中错误的是______。
搜题找答案,就上笔果题库
以下选项中不能正确把cl定义成结构体变量的是______。1、typedef struct{int red;int green;int blue;} COLOR;COLOR cl;2、struct color cl{ int red;int green;int blue;};3、struct color{ int red;int green;int blue;}cl;4、struct{int red;int green;int blue;}cl;
搜题找答案,就上笔果题库
有以下程序#include struct STU{char name[9];char sex;int score[2];};void f(struct STU a[]){ struct STU b={"Zhao",''m'',85,90};a[1]=b;}main(){ struct STU c[2]={{"Qian",''f'',95,92},{"Sun",''m'',98,99}};f(c);printf("%s,%c,%d,%d,",c[0].name, c[0].sex,c[0].score[0],c[0].score[1]);printf("%s,%c,%d,%d\n",c[1].name, c[1].sex,c[1].score[0],c[1].score[1]);}程序运行后的输出结果是______。
搜题找答案,就上笔果题库
若有以下程序#include #include #include struct stu{char *name, gender;int score;};main(){struct stu a={NULL,''m'',290},b;a.name=(char *)malloc(10);strcpy(a.name,"Zhao");b=a;b.gender=''f'';b.score=350;strcpy(b.name,"Qian");printf("%s,%c,%d,",a.name,a.gender,a.score);printf("%s,%c,%d\n",b.name,b.gender,b.score);}则程序的输出结果是______。