#include <iostream>
using namespace std;
void increment(int &n){
n++;
cout<<"In function: "<<n<<endl;
}
int main()
{
int x=5;
increment(x);
cout<<"In main: "<<x<<endl;
}
void fun2(int& a)
{
a = 5;
}
int main()
{
int b = 10;
fun2(b);
// now b = 5;
return 0;
}
int main() {
int b = 1;
fun(&b);
// now b = 10;
return 0;
}
void fun(int *a)
{
*a = 10;
}
void fun3(int a)
{
a = 10;
}
int main()
{
int b = 1;
fun3(b);
// b is still 1 now!
return 0;
}