Functions

I am a beginner and i wanted to know what does it mean if the function has a (&) before it name i mean like : int &SetTime (...) ?
It is not before the name, but after the return type. It means that it returns a reference.
it mean pass by reference.Parameter use the same memory location as argument.Changes are made to argument as well as parameter.Hence the changes are retained after function end.
Yts, as you say, what you describe is passing by reference. This is returning a reference, meaning that you return a lvalue. Which means you can actually use it with operators like ++ and -- or on the left side of an assignment operators (=, +=, etc).

So the following would be legit code (although depending on the functionality, it might not really be a logical step to make):
1
2
3
SetTime(...) = 3;
// OR
SetTime(...)++;

Just to name a few.
alright got it ;) thanks guys i really appreciate it .
Topic archived. No new replies allowed.