C Tutorial/ctype.h/isdigit

Материал из C\C++ эксперт
Перейти к: навигация, поиск

isdigit

Item Value Header file ctype.h Declaration int isdigit(int ch); Return returns nonzero if ch is a digit or zero is returned.


<source lang="cpp">#include <ctype.h>

 #include <stdio.h>
 int main(void)
 {
   char ch;
   for(;;) {
     ch = getchar();
     if(ch == "."){
         break;
     }
     if(isdigit(ch)){
         printf("%c is a digit\n", ch);
     }
   }
   return 0;
 }</source>