Question & Answer: (C programming)…..

(C programming)

(Function arguments) Design a function prototype that can accept any type of argument and return an integer.

Expert Answer

function protorype format in c is as follows :

return_type¬†function_name(argument list…..);

For the question asked … prototype is as follows: –

int func(double a);

Note that there is no templates in C , but you want it to be generic , then we can have this using C++ as follows: –

template<class T> int func1(T a) ;

here T can be any type and the function’s return type is int.

Still stressed from student homework?
Get quality assistance from academic writers!