Operator Associativity and HierarchyThis tip submitted by Avinash on 2011-09-24 05:39:06. It has been viewed 8860 times.Rating of 5.5 with 45 votes 3+4*5/6*7+8-9 Which expression will be solved first? here * and / are of same hierachy, then the rule of associativity applies, this rule says, solve the operators in the order they come, when they are in same hierarchy. this will be the solution 3+4*5/6*7+8-9 =3+20/6*7+8-9 =3+18*7+8-9 =3+126+8-9 =129+8-9 =137-9 =128 More tips Help your fellow programmers! Add a tip! |