0
why would you declare a function that uses parameters over a function that uses void
6 Réponses
+ 1
what do you mean by void? Void return type, or void as parameter (C style)
+ 1
I think you might have some terms mixed up here. Void indicates a functions return type, or more simply what type of values it will return after it finishes its code.
Parameters are the information you pass into a function.
Like for example a function that adds things together the parameters would be the two numbers you want to add and the return type would be what kind of number you want your function to return.
I hope that clears things up, if not let me know and I'll try to help explain more.
0
void return type
0
you are confused I guess, you are talking about parameters then saying void return type.
// C style
1. int func ()
2. int func (int a)
3. void func ()
4. void func (int a)
now tell which function you are taking about?
0
@B L thanks for the explanation. I was confused as to why some functions return nothing and why others return something. So from ur explanation the values that functions return can be used further in the code or in further calculations?
0
yes..that's the thing @osei