Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What does %d mean in C language?
What does %d mean in C language?
%d signed integer (decimal).

% formatter can also be used in dictionaries. You can use %(name) to refer to elements in the print format dictionary.

You can specify a minimum field width, such as "%5d"% 2. You can also specify additional precision with periods, such as "%.3d"% 3.

Extended data:

%d requires a numeric type, not a string type. The following two commands use %s to output numeric type 6 and string type 6 respectively, and the results are consistent, indicating that %s can output int type, while %d cannot output string type.

%.f represents floating-point output, and% represents floating-point output. Af means that the output keeps one digit after the decimal point, and rounding is considered (for example, %.2f keeps the last two digits, while%. F Keep the zero position (i.e. do not keep it).

We don't have to artificially distinguish whether to use %d or %s, or %f, format () function. We just need to fill our values in the corresponding curly braces.

References:

Baidu encyclopedia-sprint