有以下程序
#include
void ive(x,n)
int x[],n;
{ int t,*p;
p=x+n-1;
while(x{ t=*x;
*x++=*p;
*p--=t;
}
return;
}
void main()
{ int i,a[]={1,2,3,4,5,6,7,8,9,0};
ive(a,10);
for(i=0;i<10;i++)
printf("%d ",a[i]);
printf("\n");
}
执行后的输出结果是( )。
A. 1 2 3 4 5 6 7 8 9 0
B. 0 9 8 7 6 5 4 3 2 1
C. 1 3 5 7 9 2 4 6 8 0
D. 0 8 6 4 2 9 7 5 3 1
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e034651e.html
点击查看答案
设fp为指向某二进制文件的指针,且已读到此文件末尾,则函数feof(fp)的返回值为()。
A. EOF
B. 非0值
C. 0
D. NULL
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e0346500.html
点击查看答案
有语句char str1[10],str2[10]={"china"};则能将字符串china赋给数组str1的正确语句是( )。
A. str1={"china"};
B. strcpy(str1,str2);
C. str1=str2;
D. strcpy(str2,str1);
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e034651d.html
点击查看答案
在C语言中,要求运算数必须是整数的运算符是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4920-c089-2897e0346502.html
点击查看答案
有以下程序
#include "stdio.h"
void main()
{ union
{ int i[2];
long k;
char c[4];
}r,*s=&r;
s->i[0]=0x39;
s->i[1]=0x38;
printf("%c\n",s->c[0]);
}
执行后的输出结果是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e0346504.html
点击查看答案
以数据块为单位对数据进行整体 读写时如果ptr是指向内存中数据块的首地址,fp是文件指针,那么数据块中每个数据项的大小为( )。
A. sizeof(*ptr)
B. *ptr
C. sizeof(ptr)
D. sizeof(*fp)
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6090-c089-2897e0346505.html
点击查看答案
有以下程序
#include
main()
{ int x;
scanf("%d",&x);
if(x>15) printf("%d",x-5);
if(x>10) printf("%d",x);
if(x>5) printf("%d\n",x+5);
}
若程序运行时从键盘输入12<回车>,则输出结果为( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e0346506.html
点击查看答案
阅读下面的程序,运行结果是()。
main()
{
char *str="ABCabcd";
bubble(str,5);
printf("\n%s",str);
}
bubble(str,count)
char *str;
int count;
{
int i,j=count;
char tmp;
while(j-->1)
for(i=0;i if(str[i] {
tmp=str[i];
str[i]=str[i+1];
str[i+1]=tmp;
}
}
A. bacdCBA
B. baCBAcd
C. cdbaCBA
D. bCBAacd
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e0346517.html
点击查看答案
有以下程序
int fun(int x[],int n)
{static int sum=0,i;
for(i=0;i<n;i++) sum+=x[i];
return sum;
}
main()
{int a[]={1,2,3,4,5},b[]={6,7,8,9},s=0;
s=fun(a,5)+fun(b,4);printf("%d\n",s);
}
程序执行后的输出结果是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-58c0-c089-2897e0346518.html
点击查看答案
现有程序:
main()
{
int *ptr,*p[5],i;
if((ptr=malloc(100*sizeof(int)))!=NULL)
{
p[0]=ptr;
for(i=1;i<5;i++)
p[i]=p[i-1]+7;
for(i=0;i<100;i++)
*ptr++=i;
for(i=0;i<5;i++)
printf("%3d",*p[i]);
}
}
其输出结果是()。
A. 1 7 14 27 28
B. 0 7 14 22 28
C. 0 7 13 22 28
D. 0 7 14 21 28
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e0346509.html
点击查看答案