The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
0 votes
49 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;
}

 

in Programming by Loyal (7.4k points) | 49 views

1 Answer

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
by Junior (823 points)
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?
0

@kd.....Thanks!

Related questions

+6 votes
3 answers
1
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,339 questions
55,763 answers
192,337 comments
90,771 users