+ 2
C++ functions question
Hi all, For some reason I had to split up my question-tekst into two parts, otherwise I got errors.
5 Respuestas
+ 5
https://code.sololearn.com/ccmRwaifI8Nz/?ref=app
the variable answer is defined only inside function so by calling and printing the value of answer variable it will give error of variables not defined in main define the variable in main you will print value of answer saw above code
+ 4
please specify more what you want to ask on function, till that go through this it will help
https://www.sololearn.com/learn/CPlusPlus/1635/?ref=app
+ 1
I have a question. I was watching the following bucky video about C++ functions(https://www.youtube.com/watch?v=fQ_CBGVfGbM)
What I do not understand is that you have to cout the addNumbers and not the answer. To me it sounds more logic to print out on screen (cout) the answer(variable)…
Any explanation would be helpfull :)
+ 1
Thank you all for the answers. Sketch, yes of course you are so right.. thank you so much..
0
cause the variable answer only exist inside the addNumber functions. calling variable answer outside the function will create an error