Why outputs of i
and j
in the following two printf()
s are different?
#include <cstdio>
#define MAX(x,y) (x)>(y)?(x):(y)
int main()
{
int i=10,j=5,k=0;
k==MAX(i++,++j);
printf("%d %d %d\n",i,j,k);
i=10,j=5,k=0;
k=MAX(i++,++j);
printf("%d %d %d\n",i,j,k);
return 0;
}
I think only k
should differ, but it is showing different output for all, i
, j
and k
, in printf()
statement. What is the reason?
Output :
11 7 0
12 6 11