While creating reverse polish notation calculator. i came across this . Unable to understand why such values were being assigned while debugging , i isolated the problem statements into another simpler program which is as follows and it gives the same output which i am having difficulty understanding . Can anyone explain why is it different from my expected output (or simply how this output was reached). Your help would be highly appreciated!!
#include <stdio.h>
int main()
{
int top_stack = 1;
printf("%d\t%d\t%d" , top_stack + 1 , top_stack , top_stack++) ;
return 0;
}
Output :- 3 2 1
I was expecting the output to be 2 1 1