+ 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. âș
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
+ 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".