I dont understand this!

int Sum (int, int, &int)

i dont understand the &.

but i do understand

if (a=9 && b=3)
A single ampersand is the reference operator. Refer to this tutorial for more information. http://www.cplusplus.com/doc/tutorial/functions/

The information you need is about half way down the page.

When you pass a variable as a reference that just means that any change done to the variable inside of the function will take place outside of the function as well. Instead of passing just the value of the variable (as is done when you pass a variable normally) you are passing the memory address of the variable and this allows you to change the value stored at that address directly.
A single ampersand is the reference operator.


There is no such thing as a reference operator. Certainly, in the declaration of a variable the & lets us know the variable is a reference. However, & is also sometimes called the "address of" operator and is, in other contexts, used to obtain the bitwise and of two values.
Topic archived. No new replies allowed.