The % Format Specifiers
%c char single character
%d (%i) int signed integer
%e (%E) float or double exponential format
%f float or double signed decimal
%g (%G) float or double use %f or %e as required
%o int unsigned octal value
%p pointer address stored in pointer
%s array of char sequence of characters
%u int unsigned decimal
%x (%X) int unsigned hex value
Internally what matters is the bits arrangement not the statements.
unsigned int ui = 0xffffffff;
printf("%d", ui); // -1
printf("%u", ui); // 4294967295
When you say to the 'printf' "%u"
you're saying: "interpret my word as a unsigned bit arrangement",
and in the other side, when you say "%d"
you're saying "interpret my word as a signed bit arrangement".
%u를 쓰면 ui 변수의 bit array를 unsigned int로 해석하고 출력
%d를 쓰면 ui 변수의 bit array를 signed int 처럼 해석하고 출력한다.
int si = 0xffffffff;
printf("%d", si); // -1
printf("%u", si); // 4294967295
int 는 default type이 signed int이다.