#include <iostream>
using namespace std;
void fun1(int &x,int &y);
void fun2(int *x, int *y);
int main()
{
int a,b;
a=11;
b=22;
fun2(&a,&b);
cout<<"a="<<a<<" b="<<b<<endl;
fun1(a, b);
cout<<"a="<<a<<" b="<<b<<endl;
return 0;
}
void fun1(int &x,int &y)
{
int t;
t=x;
x=y;
y=t;
}
void fun2(int *x, int *y)
{
int *t;
t=x;
x=y;
y=t;
}
17-1体会函数参数
最新推荐文章于 2022-11-27 13:34:18 发布