Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Printf
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Precision field=== The precision field usually specifies a {{em|maximum}} limit of the output, depending on the particular formatting type. For [[floating-point]] numeric types, it specifies the number of digits to the right of the decimal point to which the output should be rounded; for {{code|%g}} and {{code|%G}} it specifies the total number of [[significant digits]] (before and after the decimal, not including leading or trailing zeroes) to round to. For the [[string (computer science)|string type]], it limits the number of characters that should be output, after which the string is truncated. The precision field may be omitted, or a numeric integer value, or a dynamic value when passed as another argument when indicated by an asterisk ({{code|*}}). For example, {{code|printf("%.*s", 3, "abcdef");|c}} outputs {{samp|abc}}.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)