+ 1
// I am a beginner.. Though I had a little c++ experience ,I still don't understand "void returns no value" ..please help me..
2 Antworten
+ 1
A function can return values or not depending on how you declare the function. For instance, an int function can return an integer value through a return statement in the function. Similarly, functions can return strings, booleans, etc. If you don't need your function to actually return anything then you can declare it void.
+ 1
void functions can be used to change something in an object when you do not need/want a return. Albeit, you dont have to use them. For instance, you can just use an int function and return any integer. you can jist forget about the returned integer.