How the following expression will be calculated: a+++b

I don't think your explanation makes much sense. It doesn't make more or less sense than: "++ operator has higher precedence than + operator, that's why expression will be computed in a following way: a + (++b)" I believe the right explanation is: Compilers try to parse expressions to the biggest token by using the left right rule. In that case: token 1: a (no bigger token available) token 2: ++ (no bigger token available) token 3: + (no bigger token available) token 4: b (no bigger token available) Since ++ operator has higher precedence than + operator, the result is: (a++) + b

2019 Jan 18, 10:20:43 AM

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes