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!