ok, im gonna get annoying now, but isnt (int n) n a return value???
ok, im gonna get annoying now, but isnt (int n) n a return value???
:heart_attack: :facepalm:
No, it's ok, you're not to blame...
A function can take any number of parameters. These parameter, like "int minimum(int a, int b)" where "int a" and "int b" are the parameters, are passed by value, meaning that a copy of each passed value is made before sent to the function. Therefore, it's the input of the function, as opposed to "return" which is the output. ( pointers can overpass this, but don't worry about them yet )
Devoted my life to programming...
im completely lost now. the way my inexperienced eyes see it, main() calls void simon(int n) to perform a calculation, simon performs the calculation using n as the value to RETURN to the main function (which would mean it has a return value), which main uses in one way or another, in this example as an integer (right) in the cout statement of main()?
If im talking rubbish and that made no sense, please correct me in laymans english lol
Also, as said in the first post, i just need to read more, or there is a more beginner-friendly book, please tell me
Last edited by brucey2343; 11-13-2012 at 11:34 AM.
"simon" just prints some text along with the value of "n" on the console. I don't get it how can you that as returning something. Anyway, you may want to browse the tutorials of this site, post #2, and start from the beginning.
Devoted my life to programming...
beacuse the void simon function is returning the integer value n to the main function?
sorry, my bad, ive just looked over the code again, it doesnt return the integer, the cout is performed on the simon function the goes back to the main fuction. correct? sorry