ju**********@yahoo.co.in wrote:
How the following expression is parsed ?
*(int *)&flag;
What are the general steps that should be followed in interpreting
such expressions ?
The precedence and associativity rules of the operators can be taken
from most text books. For example K&R2s table 2-1 list them.
You take a look at the operators and find out in which order they are to
be evaluated. In your example above (which may result in undefined
behavior and doesn't have have real live meaning at all) the "*", "()"
and "&" operator all have the same precedence but are to be evaluated
right to left according to K&R2 so it goes like.
Get the address of flag, let that address be a pointer to an int and
take the content of that int.
--
Z (zo**********@web.de)
"LISP is worth learning for the profound enlightenment experience
you will have when you finally get it; that experience will make you
a better programmer for the rest of your days." -- Eric S. Raymond