下列变量定义中合法的是()。
A. short _a=1-.le-1;
B. double b=1+5e2.5;
C. long do=0xfdaL;
D. float 2_and=1-e-3;
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4920-c089-2897e0346511.html
点击查看答案
若有以下程序段,输出结果是( )。
char s[ ]="\\141\141abc\t";
printf ("%d\n",strlen(s));
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e0346521.html
点击查看答案
若有数组定义: char array [ ]="China"; 则数组 array所占的空间为( )。
A. 4个字节
B. 5个字节
C. 6个字节
D. 7个字节
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e034651e.html
点击查看答案
有以下程序
#include
#include
void fun(char *w,int m)
{char s,*p1,*p2;
p1=w;p2=w+m-1;
while(p1}
main()
{char a[]=”123456”;
fun(a,strlen(a)); puts(a);
}
程序运行后的输出结果是( )。
A. 654321
B. 116611
C. 161616
D. 123456
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e0346514.html
点击查看答案
若有定义:int b[5];则以下对b 数组元素的正确引用是()。
A. *b[5]
B. b+2
C. *(*(b+2))
D. *(b+2)
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e034651a.html
点击查看答案
有以下程序
#include "stdio.h"
void main()
{ int a=0,b=1,c=0,d=20;
if(a) d=d-10;
else if(!b)
if(!c) d=1;
else d=25;
printf("d=%d\n",d);
}
执行后的输出结果是( )。
A. d=10
B. d=15
C. d=20
D. d=25
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e034650a.html
点击查看答案
有以下程序
#include
void main()
{
int s,i,sum();
for (i=1;i<=10;i++)
s=sum(i);
printf("s=%d\n",s);
}
sum(int k)
{
int x=0;
return (x+=k);
}
程序运行后的输出结果是 ( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e034650f.html
点击查看答案
有以下程序
#include
int fun()
{ static int x=1;
x*=2;
return x;
}
main()
{ int i,s=1;
for(i=1;i<=3;i++) s*=fun();
printf("%d\n",s);
}
程序运行后的输出结果是()。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e0346500.html
点击查看答案
有以下程序
#include
int fun()
{static int x=1;
x*=2; return x;
}
void main()
{int i,s=1;
for (i=1;i<=2;i++) s=fun();
printf("%d\n",s);
}
执行后的输出结果是( )。
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346514.html
点击查看答案
要求通过while循环不断读入字符,当读入字母N时结束循环。若变量已正确定义,以下正确的程序段是()。
A. while((ch=getchar())!="N")printf("%c",ch);
B. while(ch=getchar()!="N")printf("%c",ch);
C. while(ch=getchar()=="N")printf("%c",ch);
D. while((ch=getchar())=="N")printf("%c",ch);
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e0346526.html
点击查看答案