+ 1
What are the benefits of using void data types for functions,pointers and more?
3 Answers
+ 2
Gevork Bagratyan yes
+ 2
Void functions don't return a type. They can be used in scenarios when you want to do/change something. But don't want to return anything. Such as:
void printOneToTen(){
for(int i = 0; i < 10; i++){
cout << i;
}
}
(C++ Code)
In this case I wanted to print the numbers 1 to 10. But didn't want to return anything, so I used a void function.
+ 1
I'm assuming for functions?