+ 1

Can anyone tell me what is the utility of using void data type in c++?

4th Mar 2017, 9:31 AM
Gaurav Kaushik
Gaurav Kaushik - avatar
2 ответов
+ 3
Void is used in the functions if you don't need to return anything to the main. For example, if you have a function that sum two numbers, you can return the result to the main if your function is int/float. Instead, if your function is void, you can print the result from the function itself.
4th Mar 2017, 9:57 AM
Antares
0
For simply function returning nothing we use void
11th Mar 2017, 7:30 AM
Harsh Dhaundiyal
Harsh Dhaundiyal - avatar