下面程序#include "stdio.h" #include "string.h" main(){char *s1="AbDeG";char *s2="AbdEg";s1+=2; s2+=2;printf"%d\n",strcmp(s1,s2));}的运行结果是()
A.正数
B. 负数
C. 零
D. 不确定的值
A.正数
B. 负数
C. 零
D. 不确定的值
以下程序用来统计文件中字符个数。请填空。 include "stdio. h" main() { FILE *fp;long num=OL; if((fp=fopen("fname.dat","r")==NULL) { Pirntf("Open error\n"); exit(0);} while(【 】) { fgetc(fp);num++; } printf("num=%1d\n",num-1); fclose(fp); }
以下程序通过函数SunFun()调用F(x),x的值从0到10,这里F(x)=x2+1,由F函数实现,请填空。 include <stdio. h> int SunFun(int); int F(int); main () { pfintf("The sum = % d \n" ,SunFun(10) ); } SunFun(int n) { int x,s =0; for(x=0; x<=n; x++) s+ =F(【 】); return s; F(int x) { return (【 】);}
下面程序的输出结果是______。
#include"stdio.h"
main()
(cbar b[]="ABCD";
char*chp;
for(chp=b;*chp;chp+=2)
printf("%s\t",chp);
printf("\n");
}
下面程序的输出结果是()。 include <stdi0.h> include<string.h> main() {char*pl=“abc”,str[50]=“xyz”; strcpy(Str+2,p1); printf(“%S\n”,Str); }
A.xyzabcABC
B.zabcABC
C.xyabc
D.yzabcABC
下面程序的运行结果是()。 include<stdio.h> define_MYDEBUG void main() { ifdef_MYDEBUG printf("DEBUG"); else printf("RELEASE"); endif )
A.DEBUG
B.RELEASE
C.DEBUGRELEASE
D.程序有错误
下面程序的输出结果是【 】。 include<stdio.h> main() { static char a[]=" language" ,b[]=" program"; char *ptr1=a, *ptr2=b; int k; for(k=0;k<7;k++) if(*(ptr1+k)==*(ptr2+k)) printf(" %c",*(ptr1+k)); }
下面程序的运行结果()。 include<stdio.h> void main() { ifdef MYDEBUG int a=90; printf("a=%d\n",a); else a+=10; printf("a=%d\n",a); endif )
A.a=90
B.a=100
C.a=190
D.程序不正确