Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to output unsigned long integers in PRINTF
How to output unsigned long integers in PRINTF
Output in %lu format.

The meaning of each item is introduced as follows:

1) Type: Type characters are used to indicate the type of output data, and their format symbols and meanings are shown in the following table:

The meaning of format characters

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

O Output unsigned integers in octal form (prefix 0 is not output)

X, x outputs unsigned integers in hexadecimal form (prefix 0x is not output).

U Output unsigned integers in decimal form.

Output single-precision and double-precision real numbers in decimal form.

E, e output single-precision and double-precision real numbers in exponential form.

G, g output single-precision and double-precision real numbers, and the output width is short, which is expressed by %f or% e.

Output a single character

Output string of

2) Logo: Logo characters include-,+,# and spaces, and their meanings are shown in the following table:

Mark meaning and meaning

-The result is aligned to the left and filled with spaces to the right.

+Output symbol (plus or minus sign)

When the spatial output value is positive, it is preceded by a space, and when it is negative, it is preceded by a negative sign.

# has no effect on classes C, S, D and U; For class o, prefix o when outputting; For class X, the prefix 0x is output; For classes E, G, F, G and F, the decimal point is given only when the result has a decimal point.

3) Minimum output width: Decimal integer is used to represent the minimum number of output digits. If the actual number of digits is greater than the defined width, output according to the actual number of digits; If the actual number of digits is less than the defined width, it will be supplemented with spaces or zeros.

4) Precision: precision format characters begin with "."followed by a decimal integer. The meaning of this item is: if the number is output, it means the number of decimal places; If the output is a character, it indicates the number of characters output; If the actual number of digits is greater than the defined precision, the excess will be truncated.

5. The format characters of 5.length:length are H and L, where H represents short integer output and L represents long integer output.