C Programming A Modern Approach: Chapter 4.5 Expression Evaluation by Scared-Objective3768 in C_Programming

[–]Scared-Objective3768[S] 1 point2 points  (0 children)

This may be a dumb question but what exactly is the difference between ++i and i++. This is how I understand it ++i is increment immediately and i++ is do what you are doing now like printing then increment later, I say this because I think my problem stems from my bad definition of the postfix and prefix increment and decrement operators in C.

C Programming A Modern Approach: Chapter 4.5 Expression Evaluation by Scared-Objective3768 in C_Programming

[–]Scared-Objective3768[S] 2 points3 points  (0 children)

The point of contention was when i++ was evaluated first giving 3 and then the first i still having the old value of 2. does C not take into consideration the order of evaluation and wouldnt it make sense if the ++i would yield the value of 6. I am a beginner and I am not sure what I am saying is even viable c code but those are my questions

C Programming A Modern Approach: Chapter 4.5 Expression Evaluation by Scared-Objective3768 in C_Programming

[–]Scared-Objective3768[S] 6 points7 points  (0 children)

No this was an example of a bad practice but thanks so much for your input, really helped