Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   the %3d in printf (http://www.chiefdelphi.com/forums/showthread.php?t=36306)

Kashi Chan 18-03-2005 06:02

the %3d in printf
 
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

Re: the %3d in printf
 
mm figured out the d means decimal but not sure bout the 3

Kris Verdeyen 18-03-2005 06:32

Re: the %3d in printf
 
Quote:

Originally Posted by Kashi Chan
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

Re: the %3d in printf
 
Quote:

Originally Posted by Kris Verdeyen
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'.


All times are GMT -5. The time now is 04:43.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi