Dotcpp   >   练题 - 第230页

全部知识点

第4581题

有以下程序:

#include <stdio.h>
#include <stdlib.h>
main()
{
int *a,*b,*c;
a=b=c=(int*)malloc(sizeof(int));
*a=1;
*b=2,*c=3;
a=b;
printf("%d,%d,%d\n",*a,*b,*c);
}

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

第4582题

有以下程序:

#include <stdio.h>
#include <stdlib.h>
void fun(int*p1,int*p2,int*s)
{
s=(int*)malloc(sizeof(int));
*s=*p1+*p2;
free(s);
}
main()
{
int a=1,b=40,*q=&a;
fun(&a,&b,q);
printf("%d\n",*q);
}

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

第4583题

有以下程序

#include <stdio.h>
#include <stdlib.h>
void fun(int*p1,int*p2,int*s)
{
s=(int*)malloc(sizeof(int));
*s=*p1+*p2;
}
main()
{
int a[2]={1,2}, b[2]={10,20},*s=a;
fun(a,b,s);
printf("%d\n",*s);
}

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

第4584题

有以下程序:

#include <stdio.h>
#include <stdlib.h>
void fun(int*p1,int*s)
{
int *t;
t=(int*)malloc(2*sizeof(int));
*t=*p1+*p1++;
*(t+1)=*p1+*p1;
s=t;
}
main()
{
int a[2]={1,2}, b[2]={0};
fun(a,b);
printf("%d,%d\n",b[0],b[1]);
}

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

第4585题

有以下程序:

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
main()
{
char*p1,*p2;
p1=p2=(char*)malloc(sizeof(char)*10);
strcpy(p1,"malloc");
strcpy(p2,p1+1);
printf("%c%c\n", p1[0], p2[0]);
}

程序的运行结果是()。

第4586题

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

第4587题

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

第4588题

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

第4589题

设有以下语句

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

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

第4590题

设有如下语句

typedef struct Date
{
int year;
int month;
int day;
} DATE;

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

第4591题

若有定义:

typedef int* T;
T a[20];

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

第4592题

若有定义:

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

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

第4593题

有以下定义:

struct data
{ int i;char c;double d; } x;

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

第4594题

设有定义:

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

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

第4595题

设有定义:

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

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

第4596题

有以下程序段

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的是()。

第4597题

有以下定义和语句:

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的语句是()。

第4598题

设有如下定义:

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

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

第4599题

设有以下程序段:

struct MP3
{
char name[20];
char color;
float price;
}std,*ptr;
ptr=&std;

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

第4600题

有如下定义:

struct
{
int num;
char name[10];
struct
{
int y;
int m;
int d;
}birth;
}s,*ps=&s;

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