有以下程序#include int a[5]={ 7,10,3 };int n=3;int *p=a;void main(){int i;int a[2]={1,0};for(i=0;a[i];i++)printf("%4d",a[i]);for(i=0;a[i];i++){int a[3]={100,200,300};printf("%4d",a[i]);}printf("\n");}程序的运行结果是()。
A. 1 100
B. 1 0 100 200 300
C. 1 100 200 300
D. 1 100 200
查看答案
有以下程序#include void swap(int *pa,int *pb){int t;t=*pa;*pa=*pb;*pb=t;}void fun(int *ds,int n){int i,midx;midx=0;for(i=1;i
A. 61 37 31 26 17 12
B. 37 31 26 17 61 12
C. 17 61 12 37 31 26
D. 12 17 26 31 37 61
有以下程序#include void fun(double x, double *y,double *z){ *y = *y-1.0; *z = *z+x; }main(){ double a=2.5, b=9.0, *pa, *pb;pa=&a; pb=&b;fun(b-a,pa,pb);printf("%f\n",a);}程序运行后的输出结果是( )。
A. 8.000000
B. 9.000000
C. 1.500000
D. 10.500000
有下列程序#include #include main( ){ char v[4][10], *p[4], *t;int i,j;for (i=0; i<4; i++){ p[i] = v[i];scanf("%s", p[i]);}for (i=0; i<3; i++)for (j=i+1; j<4; j++)if (strcmp(p[i], p[j]) > 0){ t = p[i]; p[i] = p[j]; p[j] = t; }for (i=0; i<4; i++)printf("%s ", p[i]);}程序执行时若输入: Welcome you to Beijing<回车>,则输出结果是()。
A. Beijing Welcome to you
Beijing to Welcome you
C. Welcome you to Beijing
D. to you Beijing Welcome
以下涉及字符串数组、字符指针的程序片段,没有编译错误的是()。
A. char line[];line = "=============";
B. char* name[10], *str;name = "Hello World";
C. char str1[10], str2[10] = "prog.c";str1 = str2;
D. char name[10], *str = "Hello World";