+ 2
I need to know the concept behind using void(), it says the function does not return anything? It does not return what?
why we need void what are the initial conception behind using void.
5 odpowiedzi
+ 5
Every function must returns something to the caller, but for certain case, you just need to group your code into a function. And that peace of code doesn't return anything, so, you declare it as return void. Then you don't need to have a return statement in your function.
+ 4
For example, your function returns the sum of 2 argument passed to it.
int sum (int a, int b) {
int result = a + b;
return result;
}
+ 3
thanks it was helpful .
I have another question ,in your comment you have referred"every function must return something" ...can you give me some example of those "something" that functions can return.
+ 2
cool now I get it, thank you!!
+ 2
you're welcome