What is the difference between% d and% i in printf and scanf in the C language?
What is the difference between% d and% i in printf and scanf in the C language?
printf
, choose whichever you prefer. scanf
is that things are different. %d
only recognizes base 10 numbers
%i
accepts octal (prefix 0
) and hexadecimal (prefix 0x
)
250 - > decimal
0250 - > octal
0x250 - > hexadecimal