Dotcpp  >  试卷列表  >  C语言结构体和共用体

C语言结构体和共用体


第1题

以下叙述中错误的是()。

共 1 分 

第2题

以下关于typedef的叙述错误的是()。

共 1 分 

第3题

以下叙述中错误的是( )。

共 1 分 

第4题

若有说明:typedef struct{int a;char c;}w;,则以下叙述正确的是()。

共 1 分 

第5题

以下结构体类型说明和变量定义中正确的是()。

共 1 分 

第6题

设有以下语句

1
2
typedef struct TT
{char c;int a[4]} CIN;

则下面叙述中正确的是( )。

共 1 分 

第7题

若有以下语句

1
2
Typedef struct S
int g; char h;}T;

以下叙述中对的的是()。

共 2 分 

第8题

设有如下语句

1
2
3
4
5
6
typedef struct Date
{
int year;
int month;
int day;
} DATE;

则以下叙述中错误的是()。

共 1 分 

第9题

若有定义:

1
2
typedef int* T;
T a[20];

则以下与上述定义中a类型完全相同的是()。

共 1 分 

第10题

若有定义:

1
2
typedef int T[10];
T *a[20];

则与上述定义完全等价的说明语句是()。

共 1 分 

第11题

有以下定义:

1
2
struct data
int i;char c;double d; } x;

以下叙述中错误的是()。

共 1 分 

第12题

下面结构体的定义语句中,错误的是(   )。

共 2 分 

第13题

设有定义:

1
2
struct complex
{int real,unreal;} data1={1,8},data2;

则以下赋值语句中错误的是()。

共 1 分 

第14题

设有定义:

1
struct{int n;float x;}s[2],m[2]={{10,2.8},{0,0.0}};

则以下赋值语句中正确的是()。

共 1 分 

第15题

有以下程序段

1
2
3
4
5
6
7
8
struct st
{
int x;
int *y;
}*pt;
int a[]={1,2},b[]={3,4};
struct st c[2]={10,a,20,b};
pt=c;

以下选项中表达式的值为11的是()。

共 1 分 

第16题

有以下定义和语句:

1
2
3
4
5
6
7
8
9
10
11
12
13
struct workers
{
int num;
char name[20];
char c;
struct
{
int day;
int month;
int year;
}s;
}st;ruct workers w,*pw;
pw=&w;

能给w中year成员赋1980的语句是()。

共 1 分 

第17题

设有如下定义:

1
struct{int n;char c;}a[2], *p=a;

则以下错误引用结构体成员n的是()。

共 1 分 

第18题

设有以下程序段:

1
2
3
4
5
6
7
struct MP3
{
char name[20];
char color;
float price;
}std,*ptr;
ptr=&std;

要引用结构体变量std中的color成员,下列写法中错误的是()。

共 1 分 

第19题

有如下定义:

1
2
3
4
5
6
7
8
9
10
11
struct
{
int num;
char name[10];
struct
{
int y;
int m;
int d;
}birth;
}s,*ps=&s;

以下对内嵌结构体成员的引用形式错误的是()。

共 1 分 

第20题

有以下程序:

1
2
3
4
5
6
7
8
#include<stdio.h>
struct S{int a;int *b;};
main()
{
int x1[] = {3,4},x2[] = {6,7};
struct S x[] = {1,x1,2,x2};
printf("%d,%d\n",*x[0].b,*x[1].b);
}

程序的运行结果是()。

共 1 分 

第21题

若有以下定义:

1
struct tt{char name[10];char sex;} aa={"aaaa",'F'},*p=&aa;

则错误的语句是()。

共 1 分 

第22题

有以下结构体说明、变量定义和赋值语句

1
2
3
4
5
6
7
struct STD
{
char name[10];
int age;
char sex;
}s[5],*ps;
ps = &s[0];

则以下scanf函数调用语句有错误的是()。

共 1 分 

第23题

有如下定义:

1
2
3
4
5
6
struct st
{
char name[12];
int age;
char sex;
}std[10], *p=std;

以下语句错误的是()。

共 1 分 

第24题

有如下程序:

1
2
3
4
5
6
7
struct person
{
char name[10];
char sex;
float weight;
}zhangsan, *ptr;
ptr=&zhangsan;

若要从键盘读入姓名给结构体变量zhangsan的name成员,输入项错误的是()。

共 1 分 

第25题

设有定义:

1
2
3
4
5
6
struct
{
char mark[12];
int num1;
double num2;
}t1,t2;

若变量均已正确赋初值,则以下语句中错误的是()。

共 1 分 

第26题

以下叙述中正确的是()。

共 1 分 

第27题

以下叙述中正确的是()。

共 1 分 

第28题

有如下程序:

1
2
3
4
5
6
7
8
9
10
11
12
#include <stdio.h>
struct S
{
int x,y;
};
main()
{
struct S data[2] = {4,3,1,9};
int i;
for(i=0;i<2;i++)
printf("%d,%d;",data[i].x, data[i].y>>1);
}

程序运行后的输出结果是()。

共 1 分 

第29题

有以下程序:

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <stdio.h>
struct S
{
int x,y;
};
main()
{
struct S data[3] = {4,3,2,0,8,1};
int i;
for(i=0;i<3;i++)
printf("%d%d;",data[i].x, data[i].y>>1);
printf("\n");
}

程序运行后的输出结果是()。

共 1 分 

第30题

有如下程序:

1
2
3
4
5
6
7
8
9
10
11
#include <stdio.h>
struct person
{
char name[10];
int age;
};
main()
{
struct person room[2] = {{"Wang",19},{"Li",20}};
printf("%s:%d\n",(room+1)->name, room->age);
}

程序运行后的输出结果是()。

共 1 分 

第31题

有以下程序

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <stdio.h>
struct tt
{
int x;
} *sp;truct tt *y;
struct tt a[4]={20,a+1,15,a+2,30,a+3,17,a};
main()
{
int i;
p=a;
for(i=1;i<=2;i++)
{
printf("%d,",p->x);
p=p->y;
}
}

程序的运行结果是()。

共 1 分 

第32题

有以下程序:

1
2
3
4
5
6
7
8
9
#include <stdio.h>
struct st
int x,y;} data[2]={1,10,2,20};
main()
{
struct st *p=data;
printf("%d,",p->y);
printf("%d\n",(++p)->x);
}

程序运行的结果是()。

共 1 分 

第33题

有以下程序:

1
2
3
4
5
6
7
8
9
#include<stdio.h>
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));
}

程序运行后的输出结果是()。

共 1 分 

第34题

有以下程序:

1
2
3
4
5
6
7
8
9
10
#include <stdio.h>
struct S
{
int a,b;
}data[2]={10,100,20,200};
main()
{
struct S p=data[1];
printf("%d\n",++(p.a));
}

程序运行后的输出结果是()。

共 1 分 

第35题

有以下程序:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <stdio.h>
#include <string.h>
struct S
{
char name[10];
};
main()
{
struct S s1,s2;
strcpy(s1.name,"XXX");
strcpy(s2.name,"=");
s1=s2;
printf("%s\n",s1.name);
}

程序运行后的输出结果是( )。

共 1 分 

第36题

有以下程序:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <stdio.h>
#include <string.h>
struct S
{
char name[10];
};
main()
{
struct S s1,s2;
strcpy(s1.name,"12345");
strcpy(s2.name,"ABC");
s1=s2;
printf("%s\n",s1.name);
}

程序运行后的输出结果是( )。

共 1 分 

第37题

有以下程序

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
typedef struct
{
int b,p;
}A;
void f(A c)
{
int j;
c.b+=1;
c.p+=2;
}
main()
{
int i;
A a={1,2};
f(a);
printf("%d,%d\n",a.b,a.p);
}

程序运行后的输出结果是( )。

共 1 分 

第38题

有如下程序:

1
2
3
4
5
6
7
8
9
10
11
12
#include <stdio.h>
struct person
{
char name[10];
int age;
};
main()
{
struct person room[4] = {{"Zhang",19}, {"Li",20}, {"Wang",17},
{"Zhao",18}};
printf("%s:%d\n",(room+2)->name, room->age);
}

程序运行后的输出结果是()。

共 1 分 

第39题

有以下程序:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>
#include <string.h>
typedef struct
{
char name[9];
char sex;
float score[2];
} STU;
void f(STU *A)
{
strcpy(a->name,"Zhao");
a->sex='m';
a->score[1]=90.0;
}
main()
{
STU c = {"Qian",'f',95.0,92.0},*d=&c;
f(d);
printf("%s,%c,%2.0f,%2.0f\n", d->name, c.sex, c.score[0], c.score[1]);
}

程序的运行结果是()。

共 1 分 

第40题

有以下程序:

1
2
3
4
5
6
7
8
9
10
11
12
#include <stdio.h>
main()
{
struct STU
{
char name[9];
char sex;
double score[2];
}st;ruct STU a = {"Zhao",'m',85.0,90.0}, b={"Qian",'f',95.0,92.0};
b=a;
printf("%s,%c,%2.0f,%2.0f\n", b.name, b.sex, b.score[0], b.score[1]);
}

程序运行的结果是()。

共 1 分 

第41题

有以下程序:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <string.h>
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<2; i++) a.score[i]=b.score[i];
}
main()
{
STU c={"Qian",'f',95.0, 92.0};
f(c);
printf("%s,%c,%2.0f,%2.0f\n", c.name, c.sex, c.score[0], c.score[1]);
}

程序的运行结果是()。

共 1 分 

第42题

有以下程序

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdio.h>
#include <string.h>
typedef struct
{
char name[9];
char sex;
float score[2];
} STU;
STU 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<2; i++) a.score[i]=b.score[i];
return a;
}
main()
{
STU c={"Qian",'f',95.0,92.0},d;
d=f(c);
printf("%s,%c,%2.0f,%2.0f\n", d.name, d.sex, d.score[0], d.score[1]);
}

程序的运行结果是()。

共 1 分 

第43题

有以下程序

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <stdio.h>
#include <string.h>
typedef struct
{
char name[9];
char sex;
int score[2];
} STU;
STU f(STU a)
{
STU b={"zhao",'m',85,90};
int i;
strcpy(a.name, b.name);
a.sex = b.sex;
for(i=0; i<2; i++) a.score[i]=b.score[i];
return a;
}
main()
{
STU c={"Qian",'f',95,92},d;
d=f(c);
printf("%s,%c,%d,%d,", d.name, d.sex, d.score[0], d.score[1]);
printf("%s,%c,%d,%d\n", c.name, c.sex, c.score[0], c.score[1]);
}

程序运行后的输出结果是()。

共 2 分 

第44题

有以下程序:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>
struct STU
{
char name[9];
char sex;
int score[2];
}voi; d f(struct STU a[])
{
struct STU b={"zhao",'m',85,90};
a[1]=b;
}
main()
{
struct STU c[2] = {{"Qian",'f',95,92}, {"Qian",'f',95,92}};
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]);
}

程序运行后的结果是()。

共 2 分 

第45题

有以下程序:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <string.h>
typedef struct stu
{
char name[10];
char gender;
int score;
}STU;
void f(STU *c)
{
strcpy(c->name,"Qian");
c->gender='f';
c->score=350;
}
main()
{
STU a={"Zhao",'m',290},b;
b=a;
f(&b);
printf("%s,%c,%d,", a.name, a.gender, a.score);
printf("%s,%c,%d\n", b.name, b.gender, b.score);
}

程序运行后的输出结果是()。

共 2 分 

第46题

若有以下程序

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct stu
{
char *name,gender;
int score;
}STU;
void f(char *p)
{
p=(char *)malloc(10);
strcpy(p,"Qian");
}
main()
{
STU a={NULL,'m',290},b;
a.name=(char *)malloc(10);
strcpy(a.name,"Zhao");
b=a;
f(b.name);
b.gender='f';
b.score=350;
printf("%s,%c,%d,", a.name, a.gender, a.score);
printf("%s,%c,%d\n", b.name, b.gender, b.score);
}

则程序的输出结果是()。

共 2 分 

第47题

有以下程序:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <string.h>
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);
}

程序的运行结果是()。

共 2 分 

第48题

有以下程序:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <string.h>
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);
}

程序运行后的输出结果是()。

共 2 分 

第49题

若有以下程序

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stdio.h>
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);
}

则程序的输出结果是()。

共 2 分 

第50题

有以下程序

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
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);
}

程序运行后的输出结果是()。

共 2 分 

第51题

有以下程序:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
typedef struct stu
{
char name[10];
char gender;
int score;
} STU;
void f(STU a, STU *b)
{
a = *b;
printf("%s,%c,%d,", a.name, a.gender, a.score);
}
main()
{
STU a={"Zhao"'m', 290}, b={"Qian"'f', 350};
f(a,&b);
printf("%s,%c,%d\n", a.name, a.gender, a.score);
}

程序运行后的输出结果是()。

共 2 分 

第52题

有以下程序:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
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);
}

程序的运行结果是()。

共 2 分 

第53题

有以下函数:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>
struct stu
{
int num;
char name[10];
int age;
}voi; d fun(struct stu *p)
{
printf("%s\n", p->name);
}
main()
{
struct stu x[3] = {{01,"Zhang",20}, {02,"Wang",19}, {03,"Zhao",18}};
fun(x+2);
}

程序运行后的输出结果是()。

共 2 分 

第54题

有以下程序:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stdio.h>
struct STU
{
int num;
float TotalScore;
}voi; d f(struct STU p)
{
struct STU s[2] = {{20044,550}, {20045,537}};
p.num = s[1].num;
p.TotalScore = s[1].TotalScore;
}
main()
{
struct STU s[2] = {{20041,703}, {20042,580}};
f(s[0]);
printf("%d %3.0f\n", s[0].num, s[0].TotalScore);
}

程序运行后的输出结果是()。

共 2 分 

第55题

有以下程序:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>
#include <string.h>
typedef struct
{
char name[10];
char sex;
int age;
}STU;
void fun(STU *t)
{
strcpy((*t).name,"Tong");
(*t).age++;
}
main()
{
STU s[2] = {"Hua"'m', 18, "Qin"'f', 19};
fun(s+1);
printf("%s,%d,%s,%d\n", s[0].name, s[0].age, s[1].name, s[1].age);
}

程序运行后的输出结果是()。

共 2 分 

第56题

有以下程序:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>
#include <string.h>
typedef struct
{
char name[10];
char sex;
int age;
}STU;
void fun(STU t)
{
strcpy(t.name,"Tong");
t.age++;
}
main()
{
STU s[2] = {"Hua"'m', 18, "Qin"'f', 19};
fun(s[1]);
printf("%s,%d,%s,%d\n", s[0].name, s[0].age, s[1].name, s[1].age);
}

程序运行后的输出结果是()。

共 2 分 

第57题

有以下程序:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>
#include <string.h>
struct A
{
int a;
char b[10];
double c;
}voi; d f(struct A t);
main()
{
struct A a={1001,"ZhangDa",1098.0};
f(a);
printf("%d,%s,%6.1f\n",a.a,a.b,a.c);
}void f(struct A t)
{
t.a=1002;
strcpy(t.b,"ChangRong");
t.c=1202.0;
return t;
}

程序运行后的输出结果是()。

共 2 分 

第58题

有以下程序:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>
#include <string.h>
struct A
{
int a;
char b[10];
double c;
}st;ruct A f(struct A t);
main()
{
struct A a={1001,"ZhangDa",1098.0};
a=f(a);
printf("%d,%s,%6.1f\n",a.a,a.b,a.c);
}struct A f(struct A t)
{
t.a=1002;
strcpy(t.b,"ChangRong");
t.c=1202.0;
return t;
}

程序运行后的输出结果是()。

共 2 分 

第59题

有以下程序

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <stdio.h>
struct S
{
int n;
int a[20];
}voi; d f(struct S *p)
{
int i,j,t;
for(i=0;i<p->n-1;i++)
for(j=i+1;j<p->n;j++)
if(p->a[i]>p->a[j])
{
t=p->a[i];
p->a[i]=p->a[j];
p->a[j]=t;
}
}
main()
{
int i;
struct S s = {10,{2,3,1,6,8,7,5,4,10,9}};
f(&s);
for(i=0;i<s.n;i++)printf("%d,", s.a[i]);
}

程序运行后的输出结果是()。

共 2 分 

第60题

有以下程序

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
struct S
{
int n;
int a[20];
}voi; d f(int *a, int n)
{
int i;
for(i=0;i<n-1;i++)
a[i]+=i;
}
main()
{
int i;
struct S s = {10,{2,3,1,6,8,7,5,4,10,9}};
f(s.a,s.n);
for(i=0;i<s.n; i++) printf("%d,", s.a[i]);
}

程序运行后的输出结果是()。

共 2 分 

第61题

有如下程序:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <stdio.h>
struct pair
{
int first,second;
}st;ruct pair get_min_max(int*array, int len)
{
int i;
struct pair res;
res.first=array[0];
res.second=array[0];
for(i=1;i<len;i++)
{
if(array[i]<res.first)
res.first=array[i];
if(array[i]>res.second)
res.second=array[i];
}return res;
}
main()
{
int array[5]={9,1,3,4};
struct pair min_max = get_min_max(array,5);
printf("min=%d,max=%d\n", min_max.first, min_max.second);
}

程序运行后的输出结果是()。

共 2 分 

第62题

有如下程序:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
#include <string.h>
struct S
{
char name[10];
}voi; d change(struct S *data,int value)
{
strcpy(data->name, "****");
value=13;
}
main()
{
struct S input;
int num = 4;
strcpy(input.name, "THIS");
change(&input,num);
printf("%s,%d\n",input.name,num);
}

程序运行后的输出结果是()。

共 2 分 

第63题

有以下程序

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
#include <string.h>
struct S
{
char name[10];
}voi; d change(struct S *data, int value)
{
strcpy(data->name, "#");
value = 6;
}
main()
{
struct S input;
int num = 3;
strcpy(input.name, "OK");
change(&input, num);
printf("%s,%d\n", input.name, num);
}

程序运行后的输出结果是()。

共 2 分 

第64题

为了建立如图所示的存储结构(即每个结点含两个域,data是数据域,next是指向结点的指针域)

链表结构.png

则在下面结构体定义中划线处应填入的选项是()。

1
2
3
4
5
struct link
{
char data;
______;
}node;
共 1 分 

第65题

若有以下定义和语句:

1
2
3
4
5
6
struct st
{
int n;
struct st*next;
}st;ruct st a[3] = {5,&a[0], 6,&a[1],7,&a[2]}, *p;
p = &a[0];

则值为6的表达式是(提示:运算符->的优先级高于++)()。

共 2 分 

第66题

若有以下程序段

1
2
3
4
5
6
struct st
{
int n;
struct st*next;
}st;ruct st a[3] = {5,&a[1],7,&a[2],9,'\0'}, *p;
p = &a[0];

则以下选项中值为6的表达式是()。

共 2 分 

第67题

有以下程序:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <stdio.h>
struct link
{
int data;
struct link *next;
};
main()
{
struct link *h,a,b;
h=&a;
a.data=10;
a.next = &b;
b.data = 20;
}

程序运行时不能输出10,20的语句是()。

共 2 分 

第68题

有以下程序:

1
2
3
4
5
6
7
8
9
10
11
12
#include <stdio.h>
main()
{
struct node
{
int n;
} *sp;truct node *next;
struct node x[3] = {{2,x+1},{4,x+2},{6,NULL}};
p=x;
printf("%d,",p->n);
printf("%d\n",p->next->n);
}

程序运行后的输出结果是()。

共 2 分 

第69题

假定已建立以下数据链表结构,且指针p和q已指向如下图所示的结点:

链表结构.png

则以下选项中可将q所指结点从链表中删除并释放该结点的语句是()。

共 1 分 

第70题

程序中已构成如下图所示的不带头结点的单向链表结构,指针变量s、p、q均已正确定义,并用于指向链表结点,指针变量s总是作为头指针指向链表的第一个结点。

单向链表结构.png

若有以下程序段

1
2
3
q=s;s=s->next;p=s ;
while(p->next)p=p->next;
p->next=q;q->next=NULL;

该程序段实现的功能是()。

共 1 分