isdigit
raw OCR
Character classification macro.
Defined in header <ctype.h>
Syntax
#include <ctype.h>
int isdigit(int c);
isdigit is a macro that classifies ASCII-coded integer values by table
lookup. It is a predicate returning nonzero for true and 0 for false. It is
defined only when Isascii(c) is true or c isEOF.
You can make this macro available as a function by undefining (#undef) it.
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ | ■ | ■ |
Return value
isdigit returns nonzero if c is a digit (0 to 9).
Example
#include <ctype.h>
#include <stdio.h>
int main(void)
{
char c = 'C ;
if (isdigit(c))
printf("%c is a digit\n",c);
else
printf("%c isn't a digit\n",c) ;
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/ctype.h/isdigit/
· short form /3.1/isdigit/