其他分享
首页 > 其他分享> > 002:难一点的swap

002:难一点的swap

作者:互联网

 1 #include <iostream>
 2 using namespace std;
 3 
 4 void swap(
 5  int* &a,int* &b
 6 )
 7 {
 8     int * tmp = a;
 9     a = b;
10     b = tmp;
11 }
12 int main()
13 {
14     int a = 3,b = 5;
15     int * pa = & a;
16     int * pb = & b;
17     swap(pa,pb);
18     cout << *pa << "," << * pb;
19     return 0;
20 }

 

标签:tmp,cout,int,pb,002,pa,swap,一点
来源: https://www.cnblogs.com/balabalabubalabala/p/16691153.html