Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What does d% in printf mean in C language?
What does d% in printf mean in C language?
%*d in printf means output * width %d (shaping).

Example:

a = 5;

b = 6;

printf("%*d ",a,b);

Where a stands for *, that is, %5d, and the printing format is five sheets of plastic B ..

The final output result is

6. That is [4 spaces ][6].

Extended content:

Printf () function:

The printf () function is a print format function,

Usually used to output information to a standard output device in a specific format.

The calling format of printf () function is:

printf(" & lt; Format string > ",

& lt parameter list >).

Stylized strings consist of two parts:

Some are normal characters,

These characters will be output as they are; The other part is stylized prescriptive text,

Starting with "%",

Followed by one or more specified characters,

Used to determine the output content style.

The parameter table is a series of parameters for demand output.

This number must be as many as the number of output parameters described by the patterned string.

Parameters are separated by ",",

And that sequence correspond to each other one by one,

Otherwise, unexpected mistakes will occur.

Format output, which is a function to generate print format in C language (in

Standard video

Defined in). Used to output characters to terminals (monitors, consoles, etc.). ). Format control consists of text to be output and data format description. In addition to letters, numbers, spaces and some numerical symbols, the text to be output can also use some escape characters to express special meanings.

Reference: printf function

-

All sciences