Link to home
Start Free TrialLog in
Avatar of Ramprasad_Inala
Ramprasad_Inala

asked on

Macros

why does the macro increment or decrement twice before it evalutes,when we pass a increment or decrement operator as a parameter?
eg:#define macro(a) (a)*(a)

in the main function
   macro(++a);
ASKER CERTIFIED SOLUTION
Avatar of rbr
rbr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rbr
rbr

And pls read
http://www.eskimo.com/~scs/C-faq/q3.2.html

This code is not well defined and can produce any result.
An pls give a comment to your other question
https://www.experts-exchange.com/jsp/qShow.jsp?ta=cprog&qid=10326206 
Avatar of ozo
You can't depend on a being incrementyed twice, because an object shall be modified at most once between sequence points.