Conditional and assignment operator in C

On http://groups.google.co.in/group/comp.lang.c/browse_thread/thread/bfb312ad902d94eb/74dcdcacce777679?lnk=gst&q=conditional+operator#74dcdcacce777679

There is an answer to the question why (A% 2 == 0)? A = 0: A = 1 gives an error.

What I do not understand when we use (priority and associativity), and we use the C grammar to parse the expression?

+4
source share
1 answer

Always use grammar to parse expressions.

Priority and associativity are derived from grammar; they are not rules. Many priority tables are over-simplifications that do not work in some obscure cases.

+5
source

Source: https://habr.com/ru/post/1314705/


All Articles