单项选择题

有以下程序:
# include
void f(char *s, char *t)
{ char k; k=*s; *s=*t; *t=k; }
main()
{ char str[10]="abcdefg", *p
p=str+strlen(str)/2+1;
f(p, p-2); printf("%s\n",str); }
程序运行后的输出结果是()。

A.abcdefg
B.gfedcba
C.gbcdefa
D.abedcfg

<上一题 目录 下一题>
热门 试题

单项选择题
有以下程序: float f1(float n) { return n*n; } float f2(float n) { return 2*n; } main() {float(*p1)(float),(*p2)(float),(*t)(float),y1,y2; p1:f1; p2=f2; y1=p2(p1(2.0)); t=p1; p1=p2; p2=t; y2=p2(p1(2.0)); printf( %3.0f,%3.0f n ,y1,y2); } 程序运行后的输出结果是()。

A.8, 16
B.8, 8
C.16, 16
D.4, 8

单项选择题
有以下程序,其中函数f的功能是将多个字符串按字典顺序排序 #include <string,h> void f(char *p[], int n) char *t; int i,j; for(i=0; i<n-1; i++) for(j=i+1;j<n; j++) if(strcmp(p[i],p[j])>0) t=p[i];p[i]=p[j]; p[j]=t; main() char *p[5]= abc , aabdfg , abbd , dcdbe , cd ; f(p,5); printf( %d n 。strlen(p[1])); 程序运行后的输出结果是()

A.2
B.3
C.6
D.4

相关试题
  • 有以下程序: struct STU {char name...
  • 有以下程序: #include <stdio.h> m...
  • 有以下程序: int a=2; int f(int...
  • 有以下程序: #include <strino.h> ...
  • 有以下程序: #include <string.h> ...