string format definition

Source: Internet
Author: User
Tags definition format definition printf string format

string format definition

printf () function

The printf () function is a formatted output function that is generally used to output information in a prescribed format to a standard output device. This function is often used when writing programs. The call format for the printf () function is:

printf ("< format string >", < Parameter table >);

The format string consists of two parts: part of the normal character, and the characters are output as is; The other part is formatting the specified character, starting with "%" followed by one or more specified characters to determine the format of the output content.

Parameter table is a series of parameters that need to be output, the number must be the same as the number of output parameters described in the format string, the parameters are separated by "," and the order one by one corresponds, otherwise there will be unexpected errors.

form of format-string:%[flags][width]. [Precision] [{h|l|i|232|264}] Type

[Flags]----->{-, +, 0, #, blank}

Left align, sign, complement 0, output front plus space

[Width]-----Minimum number of characters for output >

[Precision]----->

{c,c: no impact.

{d,i,u,o,x,x: The minimum number of characters to output, if not enough, in front of the 0.

{f: Specify '. ' The number of characters to output, if precision is 0 or none, then no decimal.

{s,s: The maximum number of output characters, the default output to null end.

[{h|...| 264}]----> Specify the size of the following parameters.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.