有以下程序
#include
main()
{ char p[]={′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数组中都没有字符串结束符,故长度都不能确定
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6478-c089-2897e0346523.html
点击查看答案
有以下程序
#include "stdio.h"
void main()
{ int x=1,y=0,a=0,b=0;
switch(x)
{ case 1: switch(y)
{ case 0: a++;break;
case 1: b++;break;
}
case 2: a++;b++;break;
}
printf("a=%d,b=%d\n",a,b);
}
执行后的输出结果是( )。
A. a=2,b=1
B. a=1,b=1
C. a=1,b=0
D. a=2,b=2
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6c48-c089-2897e0346509.html
点击查看答案
在调用函数时,如果实参是简单变量,它与对应形参之间的数据传递方式是()。
A. 地址传递
B. 单向值传递
C. 由实参传给形参,再由形参传回实参
D. 传递方式由用户指定
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4d08-c089-2897e034650a.html
点击查看答案
若有如下定义变量:
int k=7,x=12; 则能使值为3的表达式是
()。
A. x%=(k%=5)
B. x%=(k-k%5)
C. x%=k-k%5
D. (x%=k)-(k%=5)
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4920-c089-2897e0346508.html
点击查看答案
判断两个字符串是否相等,正确的表达方式是( )。
A. while(s1==s2)
B. while(s1=s2)
C. while(strcmp(s1,s2)==0)
D. while(strcmp(s1,s2)=0)
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-50f0-c089-2897e034651f.html
点击查看答案
有以下程序
#include "stdio.h"
#include "string.h"
void main( )
{ char s1[50]={"some string *"},s2[]={"test"};
printf("%s\n", strcat(s1,s2));
}
执行后的输出结果是( )。
A. some string
B. test
C. some stritest
D. some string *test
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e0346511.html
点击查看答案
在C语言中,如果下面的变量都是int类型,则输出的结果是( )。
sum=5,p=5;p=sum++,p++,++p;
printf("%d\n",p);
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-5ca8-c089-2897e034651a.html
点击查看答案
设实型变量为f1、f2、f3、f4的值分别为4,3,2,1整型变量m1、m2
的值为1。表达式“(m1=f1>f2)&&(m2=f3
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-4920-c089-2897e034650c.html
点击查看答案
下列程序的输出结果是()。
struct abc
{ int a, b, c; };
main()
{ struct abc s[2]={{1,2,3},{4,5,6}}; int t;
t=s[0].a+s[1].b;
printf("%d \n",t);
}
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6090-c089-2897e0346508.html
点击查看答案
有以下程序
#include
void num()
{ extern int x,y;
int a=15,b=10;
x=a-b;
y=a+b;
}
int x,y;
main()
{ int a=7,b=5;
x=a-b;
y=a+b;
num();
printf("%d,%d\n",x,y);
}
执行后的输出结果是( )。
A. 12,2
B. 5,25
C. 1,12
D. 输出不确定
https://www.shititong.cn/cha-kan/shiti/0005eb65-536a-6860-c089-2897e034651b.html
点击查看答案