0

from past 2 days i have been trying to understand and apply the concept of post/pre increment operators as part of the c++ self learning modules. WHat i know: post inrement:it first asigns the value then increments. pre increment:it first increments then assigns the value. so if a=10,e=5 then ++a*e++ will be 11*5=55 but when a=2: ++a*a++ should be 3*3=9 but when i checked on the c programming terminal it says 12. i am not able to grasp how this is possible?'''

  • Simply put: Avoid accessing an in/decremented value within the same statement. For performance reasons, the makers of C++ have defined that the order of actual execution is compiler-dependant and may also differ depending where in the code this is. – AlexGeorg Jan 17 '20 at 12:29
  • oh ok i tried this out on visual studio and the online c compiler and the answer differed.Thanks a ton!! – Chandradhar Rao Jan 21 '20 at 16:03

0 Answers0