C language printf output format control, printf output format
C language printf output format Control
Printf is familiar to everyone, but it is rare to estimate its usage. Go to another article and organize it in another day.
1. Conversion
Original addressOne, Printf output formatThe general form of a format string in C is:%[flag [output minimum width] [. precision] [length] type, where the entry in square brackets [] is optional. The meanings of the items are described as follows:1.
The printf function is called the format output function, and the last letter F of its keyword is the meaning of format. The function is to display the specified data to the display screen according to the user-specified format. We have used this
Original address: http://blog.sina.com.cn/s/blog_605f5b4f0100x3ep.htmlFirst declare: in VC + + compiled printf does not automatically do type conversion, such as int a=3; printf ("%f", a), error during operation, runtime error r6002:floating point
Turn from: http://blog.csdn.net/willy3000/article/details/5786888
The parameter type of the character; output formd,i int type; Displays a signed decimal number (I and D are different when used in the scanf function).o int type; unsigned octal
From: Click to open the link
Printf output format favoritesFormat code A ABC ABCDEFGH% S A ABC ABCDEFGH% 5 S #### A ## ABC ABCDEFGH%. 5 S A ABC ABCDE% 5.5 S #### A ## ABC ABCDE%-5 s a #### ABC # ABCDEFGH
Printf format string
Format code 1-12 12345 12
Complete control Letter format of printf format
The complete format of printf format control:%-0 M. n l or H charactersThe following describes the composition formats:① %: Indicates the starting symbol of the format description, which is
/* Use the conversion specifier */# Include # Include # Define PI 3.141593 // The first method to create a symbolic constant# Define pages 93179962# Define blurb "authentic imtation! "# Define words 65618# Define pages2 336Int main (void){Printf ("\
The complete format of printf format control:%-0 M. n l or H charactersThe following describes the composition formats:① %: Indicates the starting symbol of the format description, which is indispensable.②-: "Yes" indicates the left-aligned output.
The printf function is called the format output function. The last letter of the keyword F indicates "format. The function is to display the specified data to the display screen in the format specified by the user.General Form of printf function
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.