0

why would you declare a function that uses parameters over a function that uses void

28th Feb 2017, 10:43 AM
Osei-Bonsu Kwaku
Osei-Bonsu Kwaku - avatar
6 ответов
+ 1
what do you mean by void? Void return type, or void as parameter (C style)
28th Feb 2017, 10:47 AM
Jakub Stasiak
Jakub Stasiak - avatar
+ 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.
28th Feb 2017, 10:52 AM
B L
B L - avatar
0
void return type
28th Feb 2017, 10:48 AM
Osei-Bonsu Kwaku
Osei-Bonsu Kwaku - avatar
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?
28th Feb 2017, 11:05 AM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
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?
28th Feb 2017, 11:16 AM
Osei-Bonsu Kwaku
Osei-Bonsu Kwaku - avatar
0
yes..that's the thing @osei
28th Feb 2017, 11:33 AM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar