Pick the correct statements.
I. The body of a function should have only one return statement.
II. The body of a function may have many return statements.
III. A function can return only one value to the calling environment.
IV. If return statement is omitted, then the function does its job but returns no value to the calling environment.
A. I and II
B. I and III
C. II and III
D. II and IV
E. III and IV
Answer: Option C
Join The Discussion
Comments ( 8 )
Related Questions on Function
In C, what is a function primarily used for?
A. Decision making
B. Variable declaration
C. Code organization and reusability
D. Printing output
What is the purpose of a function prototype in C?
A. To declare a function's return type
B. To declare a function's name
C. To declare a function's parameters and return type
D. To declare a function's name and parameters
In C, how are function arguments passed by default?
A. By value
B. By reference
C. By pointer
D. By address
What will be the output of the following C code? #include void main() { int a[2][3] = {1, 2, 3, 4, 5}; int i = 0, j = 0; for (i = 0; i < 2; i++) for (j = 0; j < 3; j++) printf("%d", a[i][j]); }
I think option || is wrong and |V is correct
a function can return only one value
if we only add printf or scanf function inside function (which we have defined),and not writing return statement ,then also function works.
so 4th option should be correct.
I feel that , IV option is also true. Its not mandatory to keep a return statement for a function in C. even if we didn't specify return statement, function will do its job and returns to calling function. In this process function returns no value to calling environment.
I didnt get this...
seriously??how??
how it is please explane
it