0
Explain this code please
Explain this code, please... https://code.sololearn.com/cj9m3OJZLXK2/?ref=app
4 ответов
+ 1
Sree so:
Printf uses stack, which means that your last argument is treated first then second last argument at second place... and the first argument is treated at last.
So now I'm gonna explain you the execution of your code here:
Step 1: last argument is treated first. pre-increment,++a, becomes 5 but that last is not assigned value of 5 yet. It's waiting for whole statement to execute then assign value. Yet we get value of a as 5.
Step 2: a will be evaluated next. Here we don't have incrementation, so a will remain the same, and 5 (step 1) is printed out. We still have value to be 5.
Step 3: post-increment,a++, will be evaluated next. Value of a will be turned to 6, and 6 (step 2) is printed out. So it's time for pre-increment to do its assignment of value, so last argument gets value of 6.
I hope you understood😉👌
0
please use the search bar, this question have been answered several times, just search with the keyword
0
i++ means it prints i and then increases, ++i means it increases i and then prints 👌
0
I know prefix and postfix but I've some doubts in this output...can you please explain the output of this code..and why this same program gives different output in C++
Dejan Francuz