?? list0906.cpp
字號(hào):
//Listing 9.6 Demonstrates passing by reference
#include <iostream>
using namespace std;
void swap(int *x, int *y);
int main()
{
int x = 5, y = 10;
cout << "Main. Before swap, x: " << x << " y: " << y << endl;
swap(&x,&y);
cout << "Main. After swap, x: " << x << " y: " << y << endl;
return 0;
}
void swap (int *px, int *py)
{
int temp;
cout << "Swap. Before swap, *px: " << *px <<
" *py: " << *py << endl;
temp = *px;
*px = *py;
*py = temp;
cout << "Swap. After swap, *px: " << *px <<
" *py: " << *py << endl;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -