C语言

第1121题

有如下程序:

#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);
}

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

第1122题

有以下程序

#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;
}
}

程序的运行结果是()。

第1123题

有以下程序:

#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);
}

程序运行的结果是()。

第1124题

有以下程序:

#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));
}

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

第1125题

有以下程序:

#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));
}

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

第1126题

有以下程序:

#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);
}

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

第1127题

有以下程序:

#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);
}

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

第1128题

有以下程序

#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);
}

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

第1129题

有如下程序:

#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);
}

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

第1130题

有以下程序:

#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]);
}

程序的运行结果是()。

第1131题

有以下程序:

#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]);
}

程序运行的结果是()。

第1132题

有以下程序:

#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]);
}

程序的运行结果是()。

第1133题

有以下程序

#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]);
}

程序的运行结果是()。

第1134题

有以下程序

#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]);
}

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

第1135题

有以下程序:

#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]);
}

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

第1136题

有以下程序:

#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);
}

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

第1137题

若有以下程序

#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);
}

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

第1138题

有以下程序:

#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);
}

程序的运行结果是()。

第1139题

有以下程序:

#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);
}

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

第1140题

若有以下程序

#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);
}

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