0

Is it possible to use different data type arguments in functions in C ???

Can we use different arguments in C functions ? e.g. :- void demo() int main(){ float f = 23.785; char ch = 'C'; demo(f, ch); } void demo(f, ch) { printf ("%f%c", f, ch); }

12th Sep 2020, 3:12 PM
Adarsh Suman
Adarsh Suman - avatar
2 Answers
+ 2
Yes you can do this but when you define these function then you also have to write return type of parameters you made void demo() function in your program this is wrong you have to write like this void demo(float a, char ch) . Void demo() this is valid when u don't want to pass any Values.
12th Sep 2020, 4:10 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
You can declare functions with any type with any number of parameters. Declare like this: type func_nams( type parameters1, type parameters2...) In your case you can declare: void demo(float f, char c)
12th Sep 2020, 3:20 PM
äœ çŸ„é“èŠć‰‡ïŒŒæˆ‘äčŸæ˜Ż
äœ çŸ„é“èŠć‰‡ïŒŒæˆ‘äčŸæ˜Ż - avatar