0

Prefix vs Postfix.. This is probably asked already but I can't really find my question.

How is it that this code generates the same values? If prefix increments i before? In my head this is happening: i(0); i < 10; ++i means i is now 1: commence loop. So the position of i should be 1? I did read about the compiler making a temporary copy of i and using that temp value while it changed the actual value. IS THIS WHY? for (int i = 0; i < 10; i++) { postFix[i] = i; } for (int i = 0; i < 10; ++i) { preFix[i] = i; }

16th Dec 2018, 7:42 PM
Aqua Crow
Aqua Crow - avatar
5 Antworten
+ 8
Before asking a question on the Q/A, try to search this way! 👍  • Google Advanced Search : Set domain to 》sololearn.com《 for  search only on the SoloLearn https://www.google.com/advanced_search   • Eclipse Wiki : "Before asking a question on the forums" https://wiki.eclipse.org/Before_asking_a_question_on_the_forums Have a nice Coding! ;)
16th Dec 2018, 8:53 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 1
Sounds good. Didn't know.
16th Dec 2018, 11:50 PM
Aqua Crow
Aqua Crow - avatar
0
Not following
16th Dec 2018, 7:54 PM
Aqua Crow
Aqua Crow - avatar