Anyone explain about "%i" format identifier? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Anyone explain about "%i" format identifier?

28th May 2019, 3:47 PM
Bala Kumaran
Bala Kumaran - avatar
9 Answers
+ 4
%d and %i are the same, except when you're using the scanf() function. When using scanf() the %d expects a decimal number and %i expects an integer of any type, octal, hex, decimal, etc. Entering a hex number like 0xDEAD would fail using %d but works as expected with %i.
28th May 2019, 4:45 PM
Cluck'n'Coder
Cluck'n'Coder - avatar
+ 8
Integer
29th May 2019, 6:43 PM
Bharat Bhushan
Bharat Bhushan - avatar
+ 7
Use for int
29th May 2019, 6:43 PM
Bharat Bhushan
Bharat Bhushan - avatar
+ 3
It is a placeholder for an integer value
28th May 2019, 3:56 PM
Airree
Airree - avatar
+ 2
well said cluck'n'coder thanks a lot...
28th May 2019, 4:52 PM
Bala Kumaran
Bala Kumaran - avatar
+ 2
%i is used for signed integer..in scanf() function
29th May 2019, 7:50 PM
Ajay
Ajay - avatar
0
dear airree... explain me with example program
28th May 2019, 3:59 PM
Bala Kumaran
Bala Kumaran - avatar
0
ok got it... what is the difference between %d and %i???
28th May 2019, 4:10 PM
Bala Kumaran
Bala Kumaran - avatar