+ 1

When do we use void?

In the tutorial apparently we used int instead of void to make a function with multiple parameters.

8th May 2017, 4:52 PM
NikoXO
NikoXO - avatar
5 Answers
+ 7
void is used when nothing has to be returned. Eg. void hello (int i) { cout <<i; } int main { hello(1); }
8th May 2017, 4:55 PM
Pixie
Pixie - avatar
+ 7
when we do not want to return anything 🐈
8th May 2017, 4:56 PM
NimWing Yuan
NimWing Yuan - avatar
+ 2
Void used when you do not want to return any values from function. You always must declare type of value you want return and void is like "nothing returns".
8th May 2017, 4:56 PM
Jeth
Jeth - avatar
+ 1
Usually when you want to print something without returning anything
8th May 2017, 10:03 PM
Mrs. Coder123
Mrs. Coder123 - avatar
0
When we don't have to return anything.
9th May 2017, 2:09 PM
Harshvardhan Sharma
Harshvardhan Sharma - avatar