Some output formats for C languages

Source: Internet
Author: User

%e printf () a type of floating-point number that is scientifically represented by the output format

1.24==1.240000e+000 1240000==1.240000e+006 index must not exceed 3 digits 0.00124==1.240000e-003%g printf () One output The format type, which represents the output of a single, double-precision real number in the short output width of the%f,%e, using the%e format when the exponent is less than 4 or greater than or equal to precision (the%g is used to print floating-point data, the extra 0 is removed, and at most six digits are retained (unlike the%e default reserved decimal point 6) G used to print floating-point data more than 6 bits, because of the accuracy problem,%f had to output an imprecise number of more than six digits,%e is the same, and%g will choose%e format for output, and press the first requirement, remove the extra 0, and rounded to 6 digits. This "C Primer Plus" is said to exceed the accuracy of the situation. (Visible, this 6-bit, is calculated according to the float type precision))Several output formats for the printf () function

C Output Single character

D output signed integers in decimal form (positive numbers do not output symbols)

E output single-and double-precision real-number indices in exponential form as E

E output single-and double-precision real-number indices in exponential form as E

F output single, double-precision real numbers in decimal form

G output single, double-precision real numbers with shorter output widths in%f%e, using%e format when exponent is less than 4 or greater than or equal to precision

I signed decimal integer (same as%d)

o Output unsigned integers in eight binary form (do not output prefix O)

P Output memory address form data (16 binary)

S output string

x output unsigned integers in 16-binary form (not output prefix ox)

X output unsigned integers in 16-binary form (not output prefix ox)

U output unsigned integers in decimal form

Some output formats for C languages

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.