compiler errors - C: Why can't you increment/decrement a variable twice in the same expression? -


when try compile code

int main() {     int = 0;     ++(++i); } 

i error message.

test.c:3:5: error: lvalue required increment operand      ++(++i);      ^ 

what error message saying? gets picked parser, or discovered during semantic analysis?

++i give rvalue1 after evaluation , can't apply ++ on rvalue.

§6.5.3.1 (p1):

the operand of prefix increment or decrement operator shall have atomic, qualified, or unqualified real or pointer type, , shall modifiable lvalue.


1. called "rvalue" in international standard described "value of expression". - §6.3.2.1 footnote 64).


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -