+ 2

Plz anwer this code ? Right answer is 14 but how plz explain me

#include<stdio.h> #define foo(x,y) x/y int main() { Printf("%d",foo(8+4,2+4)); Return 0; }

3rd Sep 2019, 12:41 PM
Bhavik Pandav
Bhavik Pandav - avatar
4 Answers
+ 6
It will evaluate 4, 2 because they are the ones next to the comma that shows what values are to be passed to foo. 4/2 = 2. Then it will add 8+2+4 = 14
3rd Sep 2019, 1:05 PM
Pete Cowling
Pete Cowling - avatar
+ 6
foo(8+4,2+4) == 8+4/2+4 == 8+2+4 == 14.
3rd Sep 2019, 1:02 PM
Diego
Diego - avatar
+ 3
Thank you Peter c..
3rd Sep 2019, 1:13 PM
Bhavik Pandav
Bhavik Pandav - avatar
+ 2
Thank you Diego
3rd Sep 2019, 1:04 PM
Bhavik Pandav
Bhavik Pandav - avatar