+ 1
Format specifier
In maximum conditions format specifier are know as the first element of data type. Like as: %f --> float %c --> char %s --> string ..And so on, but why an integer (int) specifier known as '%d', why it is not '%i' or any other character?? I want know only what is the meaning of "d", is "d" meaningful??? Please tell me🙂
4 Respostas
+ 5
%d for decimal that means that the number should be base 10 number you can not use it for hexadecimal or octal numbers on the other hand %i is for integer that means any integer it can be decimal, hexadecimal or octal
+ 2
.. Thanks to all, I understood 😊
+ 1
rupali
You can also use %i for int by the way,and %x for hex and %o for octal values!
Hope this helped :)
+ 1
As Ruba Kh stated, %i and %d is different. Precisely, they are different in scanf but not in printf.