0
C++ how do you know what to return.
I am struggling with the return value. How do you know if you have to return something or that you don't have to return something (through void or a constructor).
4 Answers
+ 7
Sabine See this code
https://code.sololearn.com/cibpS26A0xS6/?ref=app
+ 2
depends on what you want to use your function for. You just want it to print text to console? No need to return then, use void. You want it to generate random integer? Return int. Your function performs some math operatioms and returns tge result which may not be an integer? return double
it comes down to what you plan your functions to do
0
Thank you all :) It helped me a lot :) :)