有以下程序: #include<stdio.h> #include!(string.h> void fun(char*w,int m) { char S,*pl,*p2; p1=w;p2=w+m-; while(pl<p2){s=*pl; *p1=*p2; *p2=s;pl++;p2-;} } main( ) { char a[]="l23456"; fun(a,strlen(a));puts(a); } 程序运行后的输出结果是( )。
A.654321
B.116611
C.161616
D.l23456
第1题:
下列程序运行后,输出结果是______。 #include <stdio. h> #include <string. h> fun (char *w ,int n) { char t,*s1,*s2; s1=w; s2=w+n-1; while (s1<s2) { t=*s1++; *s1=*s2--; *s2=t; } } main () { char *p; p="1234567"; fun (p, strlen (p)); puts (p); }
A.1234567
B.7654321
C.1711717
D.7177171
第2题:
设有以下函数:
voidfun(intn,char}s){……}
则下面对函数指针的定义和赋值均正确的是( )。
A.void(*pf)(int,char);pf=&fun;
B.void+pf( );pf=fun;
C.void*pf( );*pf=fun;
D.void(*pf)(int,char*);pf=fun;
第3题:
以下程序的输出结果是【 】。
include <stdio.h>
include <string.h>
char *fun(char *t)
{ char *p=t;
return (p+strlen(t)/2);
}
main()
{ char *str="abcdefgh";
str=ftm(str);
puts(str);
}
第4题:
设有以下函数:
void fun(int n,char*$s){……}
则下面对函数指针的定义和赋值均正确的是
A.void(*pf)( );pf=fun;
B.void*Pf( );pf=fun;
C.void*pf( ); *pf=fun;
D.void(*pf)(int,char);nf=&fun;
第5题:
有以下的程序 #include<stdio.h> void fun(char *fname,char *st) { FILE *myf; int i; myf=fopen(fname,"w"); for(i=0;i<strlen(st);i++)fputc(st[i],myf); fclose(myf); } main() { fun("test.t","new world");fun("test.t","hello,");} 程序执行后,文件test.t中的内容是( )
A.hello,
B.new worldhello,
C.new world
D.hello,rld
第6题:
18、以下程序的运行结果是: #include <stdio.h> char *fun(char *px,char *py); void main() { printf("%s%s\n",fun("abc","abcd"),fun("1234","123")); } char *fun(char *px,char *py) { return (*px > *py? px : py); }
A.abcd1234
B.abc1234
C.abcd123
D.abc123