Suppose that the function f has the following definition int
Suppose that the function f has the following definition:
int f(int a, int b) { … }
which of the following statements are legal? (Assume that i has type int , x has type
double, m has type double, n has type float)
(a) i = f(83,12);
(b) x = f(83,12);
(c) i = f((int)m,(int)n);
(d) x = f(3.15,9.28);
(e) f(83,12)
Solution
Answer:
Below statements are legal
(a) i = f(83,12);
(c) i = f((int)m,(int)n);
Below two statements are legal. Becuase function f() taking two parameters type int and returning parameter type integer.
In above two scnarios, we are passing int parameters and catching return value from function as int here.
Below funtion is also valid call the function but here are not catching the return value so even call this function no result can ne caught from function.
f(83,12)
