printf("\n");
}
程序运行后的输出结果是
A)1,2,3,4,5,6,7,8,9,10,B)1,2,7,6,3,4,5,8,9,10,
C)1,2,7,6,5,4,3,8,9,10,D)1,2,9,8,7,6,5,4,3,10,
(39)有以下程序
voidsum(inta[])
{a[0]=a[-1]+a[1];}
main()
{inta[10]={1,2,3,4,5,6,7,8,9,10};
sum(&a[2]);
printf("%d\n",a[2]);
}
程序运行后的输出结果是
A)6B)7C)5D)8
(40)有以下程序
voidswap1(intc0[],intc1[])
{intt;
t=c0[0];c0[0]=c1[0];c1[0]=t;
}
voidswap2(int*c0,int*c1)
{intt;
t=*c0;*c0=*c1;*c1=t;
}
main()
{inta[2]={3,5},b[2]={3,5};
swap1(a,a+1);swap2(&b[0],&b[1]);
printf("%d%d%d%d\n",a[0],a[1],b[0],b[1]);
}
程序运行后的输出结果是
A)3553B)5335C)3535D)5353
(41)有以下程序
#include
main()
{charp[]={’a’,’b’,’c’},q[10]={’a’,’b’,’c’};
printf("%d%d\n",strlen(p),strlen(q));
}
以下叙述中正确的是
A)在给p和q数组置初值时,系统会自动添加字符串结束符,故输出的长度都为3
B)由于p数组中没有字符串结束符,长度不能确定;但q数组中字符串长度为3
C)由于q数组中没有字符串结束符,长度不能确定;但p数组中字符串长度为3
D)由于p和q数组中都没有字符串结束符,故长度都不能确定
(42)有以下程序,其中函数f的功能是将多个字符串按字典顺序排序
#include
voidf(char*p[],intn)
{char*t;inti,j;
for(i=0;ifor(j=i+1;jif(strcmp(p[i],p[j])>0){t=p[i];p[i]=p[j];p[j]=t;}
}
main()
{char*p[5]={"abc","aabdfg","abbd","dcdbe","cd"};
f(p,5);
printf("%d\n",strlen(p[1]));
}
程序运行后的输出结果是
A)2B)3C)6D)4
(43)有以下程序
#include
voidf(char*s,char*t)
{chark;
k=*s;*s=*t;*t=k;
s++;t--;
if(*s)f(s,t);
}
main()
{charstr[10]="abcdefg",*p;
p=str+strlen(str)/2+1;
f(p,p-2);
printf("%s\n",str);
}
程序运行后的输出结果是
A)abcdefgB)gfedcbaC)gbcdefaD)abedcfg
(44)有以下程序
floatf1(floatn)
{returnn*n;}
floatf2(floatn)
{return2*n;}
main()
{float(*p1)(float),(*p2)(float),(*t)(float),y1,y2;
p1=f1;p2=f2;
y1=p2(p1(2。0));
t=p1;p1=p2;p2=t;
y2=p2(p1(2。0));
printf("%3。0f,%3。0f\n",y1,y2);
}
程序运行后的输出结果是