+ 6
C Code, Getting Unexpected Output
https://code.sololearn.com/cgPNVDvpjS2k/?ref=app In this code pre increment and post increment making it difficult to understand
2 odpowiedzi
+ 5
Read the warning.. tells sequence point issue. Result is undefined by standards. May produce different results in different compiler depends on its implementation.. cannot predict outcome same on different compilers in c/c++
Generally:
Post increment : first it's value uses in statement and increments next.
Pre increment : first it's value increments the it use it's value in statement.
You can find many answers, using search bar...
https://www.sololearn.com/Discuss/2038766/?ref=app
https://www.sololearn.com/discuss/2976488/?ref=app
https://www.sololearn.com/Discuss/2981058/?ref=app
https://www.sololearn.com/Discuss/1690694/?ref=app
https://www.sololearn.com/discuss/2924308/?ref=app
read these ones, hope you can clearly understand then.....
+ 1
It's just game of associativity and precedence of increment operators (pre & post).
Here in your code, it's executing from Right to Left and printing from Left to Right.
https://www.geeksforgeeks.org/pre-increment-and-post-increment-in-c/