I am confused on the logic of expressions i++ and ++i and --i
[code]
int i, j, k;
i=3, j=4, k=5;
printf("%d ", i++ - j++ + --k); //this one is the confusing part//
printf("%d %d %d, i, j, k); // the answr depndt on 1st part//
[\code]
the above yields following output:
3 4 5 4
Why??
first integer printed = 3; why??
i= 3 j=4 k=5
i++ I am thinking i = 3+1 =4
j++ I am thinking j = 4 + 1 = 5
--k I am thinking k = -1 + 5 = 4
So with these assumptions:
i++ - j++ + --k =
4 - 5 + 4 = -5
but when I input code and compile; I get 3 HOW ??