单项选择题
有以下程序:
#include <stdio.h>
int fun(char *s)
{ char *p=s;
while(*p !="\0")p++;
return(p-s);
}
main()
{ char *p="01234";
printf("%d\n",fun(p));
}
程序的运行结果是______。
- A.3
B.6
C.4
D.5
点击查看答案&解析
相关考题
-
单项选择题
有以下程序:#include <stdio.h>main(){ char s[10]="verygood", *ps=s;ps+=4;ps="nice";puts(s);}程序的运行结果是______。
A.nice
B.verynice
C.nicegood
D.verygood -
单项选择题
以下不能将键盘输入的字符串:This is a string<回车>读入到str中的程序段是______。
A.char str[80];scanf("%s",str);
B.char str[80];int i=0;while((str[i++]=getchar())!="\n");str[i]=0;
C.char str[80];gets(str);
D.char str[80],*ps=str;do{scanf("%c",ps);}while(*ps++ !="\n");*(ps)=0; -
单项选择题
设有以下说明和语句:int x[3][4],(*p)[4];p=a;,则与表达式*(* p+2)等价的选项是______。
A.a[0][2]
B.*(a+2)[0]
C.(*a+2)[0]
D.a[2][0]
