1 | initial version |
isdigit
is a function from the C standard library defined in the header file ctype.h
, while std::isdigit
is a function from the C++ standard library defined in the header file cctype
. isdigit
takes an integer argument and returns a non-zero value if it is a digit and zero if it is not, while std::isdigit
takes a character argument and returns a bool
value indicating whether it is a digit or not. In addition, std::isdigit
is defined in the std
namespace, while isdigit
is not.
It is recommended to use std::isdigit
in C++ programs as it conforms to C++ standard and is more type-safe, whereas isdigit
may be more appropriate in C programs that use ctype.h
.