有以下程序
#include <stdio.h>
#include <string.h>
void fun(char *w,int m)
{ char s, *p1, *p2;
p1=w; p2=w+m-1;
while(p1<p2){s=*p1; *p1=*p2; *p2=s; p1++; p2- -;}
}
main()
{ char a[]=”123456”;
fun(a, strlen(a)); puts(a);
}
程序运行后的输出结果是()
A.654321
B.116611
C.161616
D.123456
[单选题]试题32有以下程序#include <stdio.h>#include <string.h>main(){ char a[5][10]={“china”, “beijing”, “you”, “tiananmen”, “welcome”};int i,j; char t[10];for(i=0; i<4; i++)for(j=i+1; j<5; j++)if(strcmp(a[i], a[j])>0){ strcpy(t, a[i]); strcpy(a
[单选题]试题36有以下程序#include <stdio.h>#include <string.h>Typedef struct {char name[9]; char sex; int score[2];}STU;STU f(STU a){ STU b={“Zhao”, ‘m’, 85, 90};int i ;strcpy(a.name, b.name);a.sex=b.sex;for(i=0; i<2; i++) a.score[i]=b.score[i];return
[单选题]有以下程序#include<stdio.h>struct tt{int x; struct tt *y;}*p;struct tt a[4]={20,a+1,15,a+2,30,a+3,17,a};main(){int I;p=a;for(i=1;i<=2;i++) printf(“%d”,p->x); p=p->y;}程序的运行结果是( )。A.20,30B.30,17C.15,30D.20,15
[试题]( 12 ) 有以下程序#include <stdio.h>#include <string.h>void fun ( char *str ){ char temp;int n,i;n=strlen ( str ) ;temp=str[n-1];for ( i=n-1;i>0;i-- ) str[i]=str[i-1];str[0]=temp;}main (){ char s[50];scanf ( " %s " ,s ) ; fun ( s ) ; printf
[单选题]试题18有以下程序#include <stdio.h>main(){ int a=1,b=0;if(- -a) b++;else if(a= =0) b+=2;else b==3;printf(“%d/n”, b);}程序运行后的输出结果是()A.0B.1C.2D.3
[单选题]试题20有以下程序#include <stdio.h>main(){ int a=7;while(a- -);printf(“%d/n”,a);}程序运行后的输出结果是()A.-1B.0C.1D.7
[单选题]试题34有以下程序#include <stdio.h>main(){ char ch[3][5]={“AAAA”, ”BBB”, ”CC”};printf(“%s/n”, ch[1];)}程序运行后的输出结果是()A.AAAAB.CCC.BBBCCD.BBB
[单选题]试题38有以下程序#include <stdio.h>main(){ int a=2,b;b=a<<2; printf(“%d/n”,b);}程序运行后的输出结果是()A.2B.4C.6D.8
[单选题]试题37有以下程序#include <stdio.h>main(){ struct node {int n; struct node *next; }*p;struct node x[3]={{2,x+1},{4,x+2},{6,NULL}};p=x;printf(“%d,”, p?n);printf(“%d/n”, p?next?n);}程序运行后的输出结果是()A.2,3B.2,4C.3,4D.4,6
[单选题]试题40有以下程序#include <stdio.h>main(){FILE *fp;int k, n, i, a[6]={1,2,3,4,5,6};fp=fopen(“d2.dat”, “w”);for(i=0; i<6; i++) fprintf(fp, “%d/n“,a[i]);fclose(fp);for(i=0; i<3; i++) fscanf(fp, “%d%d”, &k,&n);fclose(fp);printf(“%d,%d/n”, k,