While I was solving the problem of programming on codes, I found that when the format specifier "% I64d" was used several times in the same format string, for example:
long long int a, b, c;
a = 1, b = 3, c = 5;
printf("%I64d %I64d %I64d\n", a, b, c);
there was a way out
1 0 3
However, when I shared each qualifier, for example:
long long int a, b, c;
a = 1, b = 3, c = 5;
printf("%I64d ", a);
printf("%I64d ", b);
printf("%I64d ", c);
puts("");
the output was, as expected:
1 3 5
Here is an ideal link to see the above code snippets in action:
http://ideone.com/f2udRB
Please help me understand why this is happening? If this behavior is undefined, how is this output displayed? How can I understand the reasons when such unexpected results sometimes appear?
source
share