how refrence and pointer works in a function
int func (int a) { a = 300; return a; } int func2 (int& a) { a = -2; return a; } int func3 (long* a) { *a = 10; return *a; } int main() { int a = 0; int b = 0; int c = 0; long *d = new long (300); cout << func(a) << ' ' << a << '\n'; // 300 0 cout << func2(b) << ' ' << b << '\n'; // -2 -2 cout << func3(d) << ' ' << *d << '\n'; // 10 10 keep_window_open(); }