+ 1

"Void function does not return any value "- What does this actually mean?

Please provide a detailed explanation.Examples (codes) will help in understanding better. â˜ș

5th Apr 2018, 5:16 PM
Rajat C. Ghatode
Rajat C. Ghatode - avatar
2 Answers
+ 49
when function doesn't return a value , for example a method prints "hello world" on the screen & nothing else .. so its void type as it doesn't return any value //a example by me //for more examples : see the following links https://www.sololearn.com/Discuss/1032608/?ref=app https://www.sololearn.com/Discuss/807335/?ref=app
5th Apr 2018, 5:23 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 2
// c++ example void func1 () { cout << "Hello" ; } func1 (); //func1 doesn't return any value, it's just printing hello to the screen. Void is considered a data type (for organizational purposes), but it is basically a keyword to use as a placeholder where you would put a data type, to represent "no data".
5th Apr 2018, 6:13 PM
Sokrat_Poghosyan
Sokrat_Poghosyan - avatar