C Tutorial/printf scanf/scanf star


Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/includes/exception/MWExceptionHandler.php on line 179

Deprecated: Creation of dynamic property PPDStack::$accum is deprecated in /var/www/cppe.ru/www/includes/parser/Preprocessor_DOM.php on line 803

Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/includes/exception/MWExceptionHandler.php on line 179

Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/vendor/mediawiki/at-ease/src/Functions.php on line 48
Материал из C\C++ эксперт
Версия от 10:32, 25 мая 2010; Admin (обсуждение | вклад) (1 версия: Импорт контента...)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

scanf: skip the integer between the two strings

#include <stdio.h>
  int main(void)
  {
    char str[80], str2[80];
    int i;
    printf("skip the integer between the two strings:");
    scanf("%s%*d%s", str, str2);
    return 0;
  }

Use *

The * is used to suppress input.


scanf(" %d %*d %*d%*d %d ", &i, &j)

If your input is 10 20 30 40 50, i will get the value 10 and j will get the value 50.