#include<iostream>
using namespace std;
//值传递,形参改变不影响实参
void swap(int num1, int num2)
{
int a = num1;
num1 = num2;
num2 = a;
}
int main()
{
int a = 1, b = 2;
swap(a, b);
cout << a << endl;
cout << b << endl;
system("pause");
return 0;
}
网友评论