// I am a beginner.. Though I had a little c++ experience ,I still don't understand "void returns no value" ..please help me.. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

// I am a beginner.. Though I had a little c++ experience ,I still don't understand "void returns no value" ..please help me..

15th Dec 2016, 12:47 AM
xvadmin
xvadmin - avatar
2 Answers
+ 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.
15th Dec 2016, 12:55 AM
Antek
+ 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.
15th Dec 2016, 1:15 AM
Tarique Shams
Tarique Shams - avatar