0
In challenge answers are wrong
#define square (x) x*x printf ("%d",square (4+1)); choices: 4 9 5 25 I have chosen result 25 but it shows that the result is 9. Am I wrong with result 25?
13 Answers
+ 3
It would be 4+1*4+1
Due operator precedence of * multiplication takes place first
=>4+4+1=9
+ 3
What Tony Stark means is that the sum would be processed like this:
Multiplication first: 1*4 = 4
Then addition: 4 + 4 + 1 = 9
+ 1
No it's 9
+ 1
Ah yes, I missed that it was in C so it isn't BODMAS, the logic remains the same though.
+ 1
Thank you for each of you
0
Tony Stack so result 25?
0
Yes
0
Thanks Anna
0
Rincewind compiler doesn't follow BODMAS rule... It computes based on operator precedence & associativity
0
So result 25?
0
No result is 9
0
Now I got