Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

dukebound85

macrumors Core
Original poster
Jul 17, 2005
19,118
4,096
5045 feet above sea level
i know what everything in the function does except for the 2. what exactly does the 2 do when printing the integer to the screen?
i know with a float, it contols the decimal places but with an integer i have no idea

or a 3? i have seen %3d as well while i am studying for my exam tomorrow


thanks!
 

balamw

Moderator emeritus
Aug 16, 2005
19,366
979
New England
man printf

An optional decimal digit string specifying a minimum field width.
If the converted value has fewer characters than the field width, it
will be padded with spaces on the left (or right, if the left-adjust-
ment flag has been given) to fill out the field width.

B
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.