C Tutorial/printf scanf/printf star

Материал из C\C++ эксперт
Версия от 13:32, 25 мая 2010; Admin (обсуждение | вклад) (1 версия: Импорт контента...)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Specify *

<source lang="cpp">#include <stdio.h> main() {

   printf ("%*d\n", 5, 20);     // A
   printf ("%*d\n", 20, 5);     // B

}</source>

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.