View Full Version : the %3d in printf
Kashi Chan
18-03-2005, 06:02
what does the %3d do exactly? i dont see it displayed anywhere and the actual value isnt displayed till later in the statement
Kashi Chan
18-03-2005, 06:04
mm figured out the d means decimal but not sure bout the 3
Kris Verdeyen
18-03-2005, 06:32
mm figured out the d means decimal but not sure bout the 3
The 3 is the number of displayed digits.
If you use a number there, it will print leading zeros to fill up the number, up to 3. Instead of '1', it will print '001';
Greg Ross
18-03-2005, 15:01
The 3 is the number of displayed digits.
If you use a number there, it will print leading zeros to fill up the number, up to 3. Instead of '1', it will print '001';
Actually, %3d should print ' 1' (space, space, one.) You would need %03d to get '001'.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.