/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <iostream>
using namespace std;
int & f(int& );
int main()
{
int a=1;
// a 的值 和 a的記憶體位置
cout << a << " " << &a << endl;
f(a)=5;
// a 的值 和 a的記憶體位置
cout << a << " " << &a << endl;
return 0;
}
int& f(int& x){
// reference x 的值 和 x 綁定對象的記憶體位置
cout << x << " " << &x << endl;
return x;
}