Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What does %*d format output mean in C language?
What does %*d format output 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 is 6. That is [4 spaces].

Extended data:

Matters needing attention

function return value

The return value of the printf function is the number of characters whose output string is constant (note the difference between the number of characters and the number of words). Note that the count is for all printed characters, including spaces and invisible line breaks (excluding empty characters in the string).

Print a long string

Sometimes the printf statement is too long to fit on one line. If we have to split a string, there are three methods to choose from. It should be noted that we can use the "\n" line break in the string to represent the line break, but the actual line break cannot be generated by the enter key in the string.