标签:输出 mic 引用 space cpp alt image pre img
# include <iostream>
using namespace std;
void Swap(int *pa, int *pb)
{
int t = *pa;
*pa = *pb;
*pb = t;
cout << "*pa = " << *pa << endl;
}
void Swap(int &a, int &b) {
int tmp;
tmp = a;
a = b;
b = tmp;
cout << "tmp = " << tmp << endl;
}
int main()
{
int a = 3, b = 5;
Swap(&a, &b); /*执行第一个*/
Swap(a, b); /*执行第二个*/
printf("a = %d""; b = %d\n", a, b);
cout << "a = " << a << "; b = " << b << endl;
return 0;
}
输出结果
标签:输出 mic 引用 space cpp alt image pre img
原文地址:https://www.cnblogs.com/HongjianChen/p/11503889.html