有以下程序: void f(int*x iht * y) { int t; t=*x;*x;=*y;
有以下程序: void f(int*x,iht * y) { int t; t=*x;*x;=*y;*y=t; } main() { int a[8]={1,2,3,4,5,6,7,8},i,*p,*q; p=a;q=&a[7]; while(p) { f(p,q);p++;q--;} for(i=0;i<8;i++)printf("%d,",a[i]); } 程序运行后的输出结果是【 】。
请帮忙给出正确答案和分析,谢谢!
参考解答
正确答案:87654321
函数f是将x、y指针的内容互换,整个while循环是将a[0与a[7互换,a[2与a[5互换,a[3与a[4互换。
相似问题
以下程序的运行结果是【 】。 include <stdio.h> main() { int x=1
以下程序的运行结果是【 】。 include <stdio.h> main() { int x=1,y=0,a=0,b=0; switch(x) { case 1: switch(y) { case 0:a++
若a=1 b=2 则表达式!(x=a)‖(y=b)&&0的值是______。请帮忙给出正确答案和分析
若a=1,b=2,则表达式!(x=a)‖(y=b)&&0的值是______。请帮忙给出正确答案和分析,谢谢!
以下程序的功能是输出如下形式的方阵: 13 14 15 16 9 10 11 12 5 6 7 8
以下程序的功能是输出如下形式的方阵: 13 14 15 16 9 10 11 12 5 6 7 8 1 2 3 4 请填空。 main() { int i, j, x; for(j=4; j
阅读下面语句 则程序的执行结果是【 】。 include 'stdio.h' main() { in
阅读下面语句,则程序的执行结果是【 】。 include "stdio h" main() { int a=-1,b=1,k; if((++a<0)&&! (b--<=0)) printf("%d,%d n",a
以下程序的运行结果是【 】。 include<string.h> char *ss(char *s)
以下程序的运行结果是【 】。 include<string h> char *ss(char *s) {return s+strlen(s) 2;} main() { char *p,*str= "abcdefgh "; p=ss(str);printf( "%s n ",p); }请帮忙给出正确答案和分析,谢谢!
