C++Syntax
Pass by Reference
Code example
void inc(int& n) { ++n; }Lets a function modify the caller's variable.
In C++, pass by reference: lets a function modify the caller's variable — void inc(int& n) { ++n; }
void inc(int& n) { ++n; }void inc(int& n) { ++n; }Lets a function modify the caller's variable.
Use void inc(int& n) { ++n; }.
Use this pattern: void inc(int& n) { ++n; }
Yes. Use Copy code and adapt the example to your program.
No. The language syntax is the same across operating systems.