以下程序运行后的输出结果是。
#define PR(int) printf("int=%d\n",int)
main
{
int x=1,y=1,z=1;
x+=y+=z;
PR(xPR(xPR(x);
PR(y);
PR(z+=xPR(y);
}: int=2 int=2 int=3 int=3 int=4 int=4|int=3 int=2 int=3 int=3 int=4 int=3|int=3 int=2 int=3 int=3 int=4 int=4|int=4 int=2 int=3 int=3 int=4 int=4
#define PR(int) printf("int=%d\n",int)
main
{
int x=1,y=1,z=1;
x+=y+=z;
PR(x
PR(y);
PR(z+=x
}: int=2 int=2 int=3 int=3 int=4 int=4|int=3 int=2 int=3 int=3 int=4 int=3|int=3 int=2 int=3 int=3 int=4 int=4|int=4 int=2 int=3 int=3 int=4 int=4
举一反三
- 以下程序的输出结果是( )。main(){ int x=1,y=2; void swap(int x,int y); swap(x,y); printf("x=%d,y=%d\n",x,y);}void swap(int x,int y){ x=3,y=4;} A: x=3,y=4 B: x=1,y=2 C: x=3 y=4 D: x=1 y=2
- 以下设置默认值的函数原型声明中错误的是 。 A: int add(int x , int y = 4 , int z ); B: int add(int x = 3 , int y = 4 ,int z = 5 ); C: int add(int x , int y , int z = 5); D: int add(int x , int y = 4 , int z = 5);
- 如下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
- 当int x=3;int y=4;时,则表达式int z = x>y?x:y;中,z的结果是____
- 有下列程序,程序运行后的输出结果是( )。 #include void fun( int *x,int *y); int main() { int x=1,y=2; fun(&y,&x); printf("%d %d",x,y); return 0; } void fun( int *x,int *y) { printf("%d%d",*x,*y); *x=3;*y=4; }