in Programming
223 views
0 votes
0 votes

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

 

in Programming
by
223 views

1 Answer

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

4 Comments

So you mean comma will find the greater value among the two. Is it?
0
0
1
1

@kd.....Thanks!

0
0