+ 2
When i should use void for a function?
When ishould use void for a function?.. What is its idea?
2 Answers
+ 2
When you dont want to return a value you can use void function.
Here is a example for addition:
void sum(int a ,int b){
int sum = 0;
sum = a+b;
}
And then you can call the function but return function it will make easy.
int sum(int a ,int b){
return a+b;
}
And that's all.
Hope you understand!