Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What is the function of *? What is the output? Why?
What is the function of *? What is the output? Why?

The original position of * indicates the accuracy of the output

But if * is used, an integer value will be read from the parameter list to fill in

For example, this Question

int i=1;

printf("##%*d\n",i,i); //After filling, it becomes %1d

i++

printf("##%*d\n",i,i); //After filling, it becomes %2d

i++

printf("##%*d\n",i,i);//After filling, it becomes %3d

}

So the output is, I use underscores to represent spaces

##1

##_2

##__3