S
somenath
Hi All,
While browsing through the old article in this group I have come
across one article by Chrish Torek.
http://groups.google.com/group/gnu....ler+munching++++chrish+torek#d97a0f655e96ce16
In this article he said.
"Finally, let me say one last time that the Standard C grammar DOES
NOT use operator precedence. (At most, one can say that the grammar
"implies" a precedence. I believe the word "specifies" is too
strong, despite its appearance in a non-normative footnote."
So the following expression
2+3*5;
is equal to 17. For human * has higher precedence than + so *
operator will be first operated on 3*5 and then the resultant will be
added to 2. So the result will be 2+(3*5) .
Then my question is how C compiler with out bothering about precedence
produce the same result as 2+(3*5).
I tried to explain myself the outcome of 2+3*5 the way Chris Torek
has explained the expression -- - x but I am not able to construes
how the precedence of * will be enforced by the C grammar with out
using operator precedence.
Regards,
Somenath
While browsing through the old article in this group I have come
across one article by Chrish Torek.
http://groups.google.com/group/gnu....ler+munching++++chrish+torek#d97a0f655e96ce16
In this article he said.
"Finally, let me say one last time that the Standard C grammar DOES
NOT use operator precedence. (At most, one can say that the grammar
"implies" a precedence. I believe the word "specifies" is too
strong, despite its appearance in a non-normative footnote."
So the following expression
2+3*5;
is equal to 17. For human * has higher precedence than + so *
operator will be first operated on 3*5 and then the resultant will be
added to 2. So the result will be 2+(3*5) .
Then my question is how C compiler with out bothering about precedence
produce the same result as 2+(3*5).
I tried to explain myself the outcome of 2+3*5 the way Chris Torek
has explained the expression -- - x but I am not able to construes
how the precedence of * will be enforced by the C grammar with out
using operator precedence.
Regards,
Somenath