47 views

Output is 7.

But can someone justify, how?

#include <stdio.h>
int f(int a, int b) {
printf("%d", a + b);
return 0;
}
int main() {
f((2, 3), 4);
return 0;
}


When you do int a=(2,3) => a=(3) => a=3

comma evaluated first as it is in bracket which is 3 and then it is assigned to variable a

So 3+4 = 7 will be output
edited by
0
(2, 3) is evaluated to (2.3). How?
0
Its typo error I corrected
0
So you mean comma will find the greater value among the two. Is it?
+1
0

@kd.....Thanks!

1