ok, im gonna get annoying now, but isnt (int n) n a return value???
Printable View
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 )
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 :)
"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.
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
DONT! i was there at one stage, i have come so far from wondering what the hell does int, long, double, string and the sorts mean, keep it up, things will click and you will get there! TIP, get more than one book, try to get idea's for things from different sources.