What is the difference between% d and% i in printf and scanf, in C language? [duplicate]

2

What is the difference between% d and% i in printf and scanf in the C language?

    
asked by anonymous 18.09.2018 / 19:47

1 answer

3
  • Are interpreted equal in printf , choose whichever you prefer.
  • No 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

    
18.09.2018 / 19:52