鑫鑫打印社印 2014年~2015学年《C语言程序设计》复习题
1 2 4 8 30.下列程序
copy_string(from,to) char *from,*to; {
*to++=*from++; *to= \0 ; } main() {
static
s1[ ]=”c_program.”; static char s2[80]; copy_string(s1,s2); printf(“%s\n”,s2); copy_string(“123”,s2); printf(“%s\n”,s2); }
运行后输出的数据为( )。
c_program 123
31.下列程序: #include <stdio.h> main()
while(*from) { char a[40],b[40];
int i,j;
printf(“Enter the string:”); i=j=0; \0 )
{ if(!(a[i]>= \0 &&a[i]<= 9 )) { b[j]=a[i]; j++; } ++i; } b[j]= \0 ; printf(“%s”,b); }
运行后输出的结果是
4 8 2 4 2 4
A. c_program 123 B.123 ( ) 。
C. c_program123 D. A. 把键盘输入的字符串显示