- 33
- 0
- 约1.29千字
- 约 4页
- 2017-07-09 发布于江西
- 举报
2014C程序设计编程题(不含答案)
1.以下程序的功能是:通过指针操作,找出三个整数中的最小值并输出。
请填空。
#include stdlib.h
main()
{int *a,*b,*c,num,x,y,z;
a=x;b=y;c=z;
printf(输入3个整数:);
scanf(%d%d%d,a,b,c);
printf(%d,%d,%d\n,*a,*b,*c);
num=*a;
if(*a*b)______;
if(num*c)______;
printf(输出最小整数:%d\n,num);
}
2.下面程序段的运行结果是________.
char s[80],*sp=HELLO!;
sp=strcpy(s,sp);
s[0]=h;
puts(sp);
3.下面程序段的运行结果是________.
char str[]=abc\0def\0ghi,*p=str;
printf(%s,p+5);
4.下面程序的功能是将两个字符串s1和s2连接起来。请填空。
#includestdio.h
main()
{char s1[80],s2[80];
gets(s1); gets(s2);
conj(s1,s2);
puts(s1);
}
conj(char *p1,char *p2)
{char *p=p1;
while(*p1)______;
while(*p2){*p1=______;p1++;p2++;}
*p1=\0;
__________;
}
5.若有定义:int a[]={2,4,6,8,10,12},*p=a;则*(p+1)的值是______. *(a+5)的值是_________.
6.若有以下定义:int a[2][3]={2,4,6,8,10,12};则a[1][0]的值是_____. *(*(a+1)+0))的值是________.
7.以下程序将数组a中的数据按逆序存放,请填空。
#define M 8
main()
{int a[M],i,j,t;
for(i=0;iM;i++)scanf(%d,a+i);
i=0;j=M-1;
while(ij)
{
t=*(a+i);________;*(_______)=t;
i++;j--;
}
for(i=0;iM;i++)printf(%3d,*(a+i));
}
8.若有定义:int a[3][5],i,j;(且0=i3,0=j5),则a数组中任一元素可用
五种形式引用。它们是:
(1)a[i][j]
(2)*(a[i]+j)
(3)*(*______);
(4)(*(a+i))[j]
(5)*(____+5*i+j)
9.下面程序的运行结果是_________.
main()
{char *a[]={Pascal,C language,dBase,Coble};
char (**p)[];
int j;
p=a+3;
for(j=3;j=0;j--)printf(%s\n,*(p--));
}
2
原创力文档

文档评论(0)