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
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