isdigit

Tests for a decimal-digit character (function or macro)

Local Servers:nonblocking
Remote Servers:N/A
Classification:ANSI
Service:Character Manipulation

Syntax

  #include <ctype.h>  
   
  int isdigit  (  
     int   c);
  

Parameters

c
(IN) Specifies the character to be tested.

Return Values

isdigit returns a nonzero value when the argument is a digit. Otherwise, a value of 0 is returned.

Remarks

The isdigit function or macro tests for any decimal-digit character (0 to 9).

See Also

isalnum, isalpha, iscntrl, islower, isprint, ispunct, isspace, isupper, isxdigit, tolower, toupper

Example

  #include <stdio.h>  
  #include <ctype.h>  
   
  main ()  
  {  
     char   *s, *p = "QRSTU1234ABC";  
     for (s = p; *s; s++)  
        printf ("%d", isdigit (*5));  
  }
  

produces the following:

  0 0 0 0 0 1 1 1 1 0 0 0