niusouti.com

以下程序的输出结果是include "stdio.h"int *f(int *x,int *y){ if(*x<*y) return x; else return y;}main(){ int a=7,b=8, *p,*q,*r ; p=&a; q=&b; r= f(p,q); printf("%d,%d,%d\n",*p,*q,*r);}

题目

以下程序的输出结果是include "stdio.h"int *f(int *x,int *y){ if(*x<*y) return x; else return y;}main(){ int a=7,b=8, *p,*q,*r ; p=&a; q=&b; r= f(p,q); printf("%d,%d,%d\n",*p,*q,*r);}


相似考题
更多“以下程序的输出结果是include "stdio.h"int *f(int *x,int *y){ if(*x&lt;*y) return x; else re ”相关问题
  • 第1题:

    以下程序执行后的输出结果是include using namespace std;void try(int,int,int,int)

    以下程序执行后的输出结果是 #include <iostream> using namespace std; void try(int,int,int,int); int main () { int x,y,z,r; x =1 ; y = 2; try(x,y,z,r); cout<<r<<endl; return 0; } void try(int x,int y,int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }

    A.18

    B.9

    C.10

    D.不确定


    正确答案:D
    解析:本题考核函数调用(参数的传递)。本题常见的错误解答是:把x=1,y=2代入到函数try中,逐步计算出r=8。最后得到r的输出值是8。以下是正确解答,根据程序逐步分析:程序中定义了一个名为try的void型函数,即函数try没有任何返回值。而try函数在main函数中是以一条独立语句的方式被调用的,且main函数最后输出变量r的值。但在main函数中,并没有对变量r赋值。在c++语言中,数据只能从实参单向传递给形参,称为按值传递。也就是说,当简单变量作为实参时,用户不能在函数中改变对应实参的值。所以虽然在函数try中,r的值为8,但它并不能传递给实参,当然最终的输出肯定是不确定的随机数了。

  • 第2题:

    以下程序执行后的输出结果是()。includeusing namespace std;void try(int,int,int,in

    以下程序执行后的输出结果是( )。 #include<iostream> using namespace std; void try(int,int,int,int); int main() { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<endl; return 0; } void try(int x,int y, int z,int r) { z = x+y; X = x*x; y = y*y; r = z+x+y; }

    A.18

    B.9

    C.10

    D.不确定


    正确答案:D

  • 第3题:

    以下程序输出的结果是()。includeusing namespace std;int main(){int **x,*y,z=10;y=

    以下程序输出的结果是( )。 #include<iostream> using namespace std; int main() { int **x,*y,z=10; y=&z; x=&y; cout<< **x+1<<endl; return 0; }

    A.11

    B.x的地址

    C.y的地址

    D.运行错误


    正确答案:A
    解析:执行语句y=&z;后,指针y指向了变量z。执行语句x=&y;后,指针**x指向z。所以**x的值为z的值10,那么程序最后输出为11。

  • 第4题:

    以下程序执行后的输出结果是includeusing namcspace std;void try(int,int,int,int);

    以下程序执行后的输出结果是 #include<iostream> using namcspace std; void try(int,int,int,int); int main() { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; } void try(int x,int y, int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }

    A.18

    B.9

    C.10

    D.不确定


    正确答案:D
    解析:本题考核函数调用(参数的传递)。本题常见的错误解答是:把x=1,y=2代入到函数try中,逐步计算出r=8。最后得到r的输出值是8。以下是正确解答,根据程序逐步分析:程序中定义了一个名为try的void型函数,即函数try没有任何返回值。而try函数在main函数中是以一条独立语句的方式被调用的,且main函数最后输出变量r的值。但在main函数中,并没有对变量r赋值。在C++语言中,数据只能从实参单向传递给形参,称为按值传递。也就是说,当简单变量作为实参时,用户不能在函数中改变对应实参的值。所以虽然在函数try中,r的值为8,但它并不能传递给实参,当然最终的输出肯定是不确定的随机数了。

  • 第5题:

    以下程序执行后的输出结果是include.using namespace std;void try(int,int,int,int)

    以下程序执行后的输出结果是 #include<iostream>. using namespace std; void try(int,int,int,int); int main() { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; } void try(int x,int y, int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }

    A.18

    B.9

    C.10

    D.不确定


    正确答案:D
    解析:本题考核函数调用(参数的传递)。本题常见的错误解答是:把x=1,y=2代入到函数try中,逐步计算出r=8。最后得到r的输出值是8。以下是正确解答,根据程序逐步分析:程序中定义了一个名为try的void型函数,即函数try没有任何返回值。而try函数在main函数中是以一条独立语句的方式被调用的,且main函数最后输出变量r的值。但在main函数中,并没有对变量r赋值。在C++语言中,数据只能从实参单向传递给形参,称为按值传递。也就是说,当简单变量作为实参时,用户不能在函数中改变对应实参的值。所以虽然在函数try中,r的值为8,但它并不能传递给实参,当然最终的输出肯定是不确定的随机数了。