Niti, d+=5 will be evaluated first because you have put it inside of (), which has a higher precedence thatn +, -, and ++. Nick
posted 18 years ago
Thanks Nick, but if the case is d++ - ++d + --d + d++ + d-- then which will be the first to increment. one more thing though in any case "++" is given first priority,but out of this a)++d OR b)d++ will be given priority. Thanks once again. Waiting for reply...
Hi Niti, When operators have the same priority they are evaluated left-to-right. Evaluation of your example, assuming d=0, would be: <pre> x = d++ - ++d + --d + d++ + d-- 0 2 1 1 2 -2 1 1 2 -1 1 2 0 2 2 Final result assigned to x </pre> Value of d: 1 (last operator is a postfix) You can use a neat trick to 'dump' intermediate results. Ajith Kalembella used it in one of his posts
Hope that helps. ------------------ Jane The cure for boredom is curiosity. There is no cure for curiousity. -- Dorothy Parker [This message has been edited by Jane Griscti (edited November 02, 2000).] [This message has been edited by Jane Griscti (edited November 02, 2000).]