What will be the output of the following code segment, if the function is called as larger(10, 20)

1.3 What will be the output of the following code segment, if the function is called as
larger(10, 20) ?
int larger(int x, int y) {
int max = x;
if (max < y) {
max = y;
return y;
}
else
return x;
printf(“Larger of %d and %d is %d”, x, y, max);
}
A) Program will not compile as the function has two return statements.
B) Program will not compile as no statement is allowed after return statement.
C) Larger of 10 and 20 is 20.
D) No output.


Leave a Reply