Specify * : printf star « printf scanf « C Tutorial






#include <stdio.h>
main()
{
    printf ("%*d\n", 5, 20);     // A
    printf ("%*d\n", 20, 5);     // B
}
20
                        5

In A, 5 is substituted for * and it indicates putting the value 20 in 5 columns.

In B, 20 is substituted for * and it indicates putting the value 5 in 20 columns.









4.17.printf star
4.17.1.Specify *