Home > Backend Development > C#.Net Tutorial > The meaning of %d,%s,%x,%f,%.100 in C language

The meaning of %d,%s,%x,%f,%.100 in C language

little bottle
Release: 2019-04-08 14:01:48
forward
8641 people have browsed it

The character format description of C language consists of "%" and format characters, such as %d%f, etc. Its function is to convert the output data into the specified format for output. Format descriptions always begin with the "%" character.

Format characters include d, o, x, u, c, s, f, e, g, etc., such as:

%d integer output, %ld long integer output,

%o output integer in octal form,

%x outputs an integer in hexadecimal form, or the address of a string.

%u outputs unsigned data (unsigned number) in decimal form. Note: %d and %u have unsigned numerical ranges, which are the limit values, otherwise the printed values ​​will be incorrect.

%c is used to output a character,

%s is used to output a string,

%f is used to output real numbers in decimal form, with 6 decimal places retained by default.

%.100f is used to output real numbers, retains 100 decimal places.

%e outputs real numbers in exponential form,

%g automatically selects f format or e format according to the size, and does not output meaningless numbers. zero.

【Recommended Course: C Video Tutorial

The above is the detailed content of The meaning of %d,%s,%x,%f,%.100 in C language. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template