+ 1
Can anyone tell me what is the utility of using void data type in c++?
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.
0
For simply function returning nothing we use void