【单选题】【消耗次数:1】
程序段char a[ ]=“English”; char *p=a; int n=0; while( *p!=‘\0’){ n++; p++;} 结果中,n的值是( )。
A. 6
B.8
C.5
D.7
参考答案:
复制
纠错
相关题目
【单选题】 程序段char a[ ]=“English”; char *p=a; int n=0;while( *p!=‘\0’){ n++; P++;}结果中,P指向( )。
①  A. 字符h
②  B.a
③  C. 字符串的结束符
④  D.7
【简答题】 int a[10]={0,1,2,3,4,5,6,7,8,9};int *p;int i;p=a;printf(%d\n,*p++);printf(%d\n,*++p);程序输出结果为[填空1]和[填空2]。
【简答题】 #includestdio.hint main(){int a[10]={0,1,2,3,4,5,6,7,8,9};int *p;p=a;printf(%d\n,*p);p++;printf(%d\n,*p);}程序输出结果为[填空1]和[填空2]。
【单选题】 下述程序的运行结果( )。 #includevoid main() { int p,a=0; if(p=a!=0)printf(%d\n else printf(%d\n,p+2); }
①  1
②  2
③  3
④  5
【单选题】 以下函数的返回结果是( )。 int function(char *x) { char *p=x; while(*p++); return(p-x-1); }
①  求字符串的长度B.将字符串x连接到字符串p后面
②  将字符串x复制到字符串p中
③  将字符串x反向存放
【单选题】 以下函数的返回结果是( )。 int function(char *x) { char *p=x; while(*p++); return(p-x-1); }
①  求字符串的长度B.将字符串x连接到字符串p后面
②  将字符串x复制到字符串p中
③  将字符串x反向存放
【单选题】 以下函数的返回结果是() int function(char *x) { char *p=x; while(*p++); return(p-x-1); }
①  求字符串的长度
②  将字符串x连接到字符串p后面
③  将字符串x复制到字符串p中
④  将字符串x反向存放
【单选题】 以下函数的返回结果是(????) int function(char *x) { char *p=x; while(*p++); return(p-x-1); }
①  求字符串的长度
②  将字符串x连接到字符串p后面
③  将字符串x复制到字符串p中
④  将字符串x反向存放
【单选题】 设有如下函数定义 int f(char *s) { char *p=s; while(*p!=’\0’) p++; return(p-s); } 在主函数中用coutf(“good”)调用上述函数, 则输出结果为( )
①  3
②  4
③  5
④  6
【单选题】 设有如下函数定义 int f(char *s) { char *p=s; while(*p!=’\0’) p++; return(p-s); } 在主函数中用coutf(“good”)调用上述函数, 则输出结果为( )。
①  3
②  4
③  5
④  6
随机题目
【简答题】 查找n在数组a中最后一次出现的位置(数组首元素的位置为零)。 例如:如果a数组中的元素为:1,5,2,5,6,8,7,4,3,0, 当n=5时,程序的输出结果为:5 is No.3 。 当n=10时,程序的输出结果应为:10 not found !。 #includevoid main( ) { int a[10]={1,5,2,5,6,8,7,4,3,0}; int i,k,n,f=0; scanf(%d, for(i=0;ii++) /************found************/ if([填空1]) { f=1; /************found************/[填空2] } if(f) printf(%d is No. %d\n, n,k); else printf( %d not found !\n }
【简答题】 求二分之一的圆面积,函数通过形参得到圆的半径,函数返回二分之一的圆面积(注意:圆面积公式为:S=3.14159*r*r,在程序中定义的变量名要与公式的变量相同)。例如,输入圆的半径值:2.5,输出为s=9.817469。 #include/************found************/ double fun ( float[填空1] ) { return 3.14159 * r*r/2.0 ; } main() { float printf ( Enter x: /************found************/ scanf ( %f,[填空2] printf ( s = %f\n , fun ( x ) ); }
【简答题】 计算两个整数n和m(m1000)之间所有数的和。n和m从键盘输入。例如,当n=1,m=100时,sum=5050,当n=100,m=1000时,sum=495550。 #include#includemain() { int n,m; int sum; /************found************/[填空1] printf(\nInput n,m\n scanf(%d,%d,n, while( n=m ) { /************found************/[填空2] n++; } printf(sum=%d \n,sum); }
【简答题】 打印出1至1000中满足其个位数字的立方等于其本身的所有整数。本题的结果为:1 64 125 216 729。 #includemain() { int i,g; for(i=1;ii++) { /************found************/ g=i[填空1] /************found************/ if([填空2]) printf(%4d } printf(\n }
【单选题】 C语言程序的基本单位是
①  程序行
②  语句
③  函数
④  字符
【单选题】 以下一维数组a的正确定义是
①  int a(10);
②  int n=10,a[n];
③  int n;
④  #define SIZE 10 scanf(%d, int a[SIZE]; int a[n];
【单选题】 下面程序的输出结果是 #includevoid main() { int a=5,b=3; float x=3.14, y=6.5; printf(%d,%d\n,a+b!=a-b,x=(y-=6.1)); }
①  1,0
②  0,1
③  1,1
④  0,0
【单选题】 如果一个函数位于C程序文件的上部,在该函数体内说明语句后的复合语句中定义了一个变量,则该变量
①  为全局变量,在本程序文件范围内有效
②  为局部变量,只在该函数内有效
③  为局部变量,只在该复合语句中有效
④  定义无效,为非法变量
【单选题】 下列一组初始化语句中,正确的是
①  int a[8]={
②  int a[9]={0,7,0,4,8};
③  int a[5]={9,5,7,4,0,2};
④  int a[7]=7*6;
【单选题】 C语言规定,除主函数外,程序中各函数之间
①  既允许直接递归调用也允许间接递归调用
②  不允许直接递归调用也不允许间接递归调用
③  允许直接递归调用不允许间接递归调用
④  不允许直接递归调用允许间接递归调用