On this page
  1. isdigit
  2. Include
  3. Signature & Overview
  4. Notes & Pitfalls
  5. Example

isdigit

Prev: ctype.h | Up: ctype.h | Next: isalpha
Rel: ctype.h, Arrays & C Strings
Ref: cppreference — isdigit
Tags: #public #prog #c #stdlib #ctype #tier/core


Include

#include <ctype.h>

Signature & Overview

int isdigit(int ch);

Returns non-zero if ch is an ASCII decimal digit '0'–'9'.

Notes & Pitfalls

Example

#include <assert.h>
#include <ctype.h>

int main(void) {
    assert(isdigit((unsigned char)'7') != 0);
    assert(isdigit((unsigned char)'a') == 0);
}

Linked from

Related notes