0

How a+++b is tokenised?

How is this interpreted?

14th Jan 2018, 3:22 PM
mayur
mayur - avatar
5 Answers
0
a+b a+1 So a=1, b=3: a+b = 4 a=a+1 = 2 Thus, a=2, b= 3, c=a+b= 4
14th Jan 2018, 3:42 PM
Andreas K
Andreas K - avatar
0
it depends on the compiler since C does not have a standart, some will start from the left (++b + a) some from the right ((a++) + b) which will influence the result.
14th Jan 2018, 4:11 PM
capsloth
capsloth - avatar
0
When i tried to execute it, it showed ans as that of (a+b) only... I am not getting how it is executed Plz do help
14th Jan 2018, 4:25 PM
mayur
mayur - avatar
0
then maybe its possible its going like this: b + a++ (getting the arguments left to right)
14th Jan 2018, 4:32 PM
capsloth
capsloth - avatar
0
Yeah...it is b + a++... Because a is incrementing by 1.. Thank you @capsloth
14th Jan 2018, 4:35 PM
mayur
mayur - avatar