In case of evaluation of postfix expression , is the associativity always left to right?. If yes, why? If no, why?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Yes.
See this handy table of C's operators.
The postfix operators are:
++
and--
()
(function call)[]
(array indexing).
(member select)->
(member select)
And they are all in the left-to-right precedence group (2) near the top of the table.
I guess the "why" is since that's how the language is defined. There are no "natural causes" for these kinds of things, they're human-made you know.