• 2021-04-14
    有以下程序
    void f( int y,int *x)
    {y=y+*x; *x=*x+y;}
    main( )
    { int x=2,y=4;
    f(y,&x);
    printf(“%d %d ”,x,y);
    } 执行后输出的结果是
  • 8 4

    内容

    • 0

      如下C程序的输出是什么?#include [stdio.h]void Func1 (int x, int y);void Func2 (int *x, int *y); int main() { int x = 3; int y = 4;Func1 (x, y); printf ("x = %d, y = %d\n", x, y);Func2(&x, &y); printf ("x = %d, y = %d\n", x, y);} void Func1 (int x, int y) { x = x + y; y = x - y; x = x - y; printf ("x = %d, y = %d\n", x, y);} void Func2 (int *x, int *y) { *x = *x + *y; *y = *x - *y; *x = *x - *y;;} A: x = 3, y = 4x = 3, y = 4x = 3, y = 4 B: x = 4, y = 3x = 4, y = 3x = 4, y = 3 C: x = 3, y = 4x = 3, y = 4x = 4, y = 3 D: x = 4, y = 3x = 3, y = 4x = 4, y = 3

    • 1

      以下程序的运行结果是_____________ #include "stdio.h" void main() { void add(int x,int y, int z); int x=2,y=3,z=0; printf("(1)x=%d y=%d z=%d\n",x,y,z); add(x,y,z); printf("(3)x=%d y=%d z=%d\n",x,y,z); } void add(int x,int y, int z) { z=x+y; x=x*x; y=y*y; printf("(2)x=%d y=%d z=%d\n",x,y,z); }

    • 2

      下面程序的运行结果是(<br/>)。 int fun (int x,int y) { x=x+y; return(x);}int main( ) { int x=2,y=4; y=fun (x,y); printf("x=%d y=%d\n", x, y);} A: x=2<br/>y=4 B: x=2<br/>y=6 C: x=6<br/>y=6 D: x=6<br/>y=4

    • 3

      【单选题】有以下程序: #include <stdio.h> int main() { float x=2.5; int y; y=(int)x; printf("x=%f , y=%d",x,y); return 0; } 程序运行后,输出结果是: A. x=2.5 , y=2.5 B. x=2.5 , y=2 C. x=2.500000 , y=2.5 D. x=2.500000 , y=2

    • 4

      以下程序的运行结果是【 】。 void f(int a, int b) { int t; t=a; a=b; b=t; } main() { int x=1, y=3, z=2; if(x>y) f(x,y); else if(y>z) f(x,z); else f(x,z); printf("%d,%d,%d ",x,y,z); }