isdigit : isdigit « ctype.h « C Tutorial






ItemValue
Header filectype.h
Declarationint isdigit(int ch);
Returnreturns nonzero if ch is a digit or zero is returned.


#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;
  }
1
1 is a digit
2
2 is a digit
3
3 is a digit
f
.








18.5.isdigit
18.5.1.isdigit