---
name: "digittoint"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd", "macos"]
url: "https://new.carta.tech/digittoint"
---

# digittoint(3)

convert a numeric character to its integer value

## NAME

**digittoint**, **digittoint\_l** – convert a numeric character to its integer value

## LIBRARY

Standard C Library (libc, -lc)

## SYNOPSIS

**#include \<ctype.h\>**

*int*\

**digittoint**(*int c*);

*int*\

**digittoint\_l**(*int c*, *locale\_t loc*);

## DESCRIPTION

The **digittoint**() and **digittoint\_l**() functions convert a numeric character to its corresponding integer value. The character can be any decimal digit or hexadecimal digit. With hexadecimal characters, the case of the values does not matter.

The **digittoint\_l**() function takes an explicit locale argument, whereas the **digittoint**() function use the current global or per-thread locale.

## RETURN VALUES

The **digittoint**() and **digittoint\_l**() functions always return an integer from the range of 0 to 15. If the given character was not a digit as defined by [isxdigit(3)](/isxdigit/3.md) or [isxdigit\_l(3)](/isxdigit_l/3.md), the function will return 0.

## SEE ALSO

[ctype(3)](/ctype/3.md), [ctype\_l(3)](/ctype_l/3.md), [isdigit(3)](/isdigit/3.md), [isdigit\_l(3)](/isdigit_l/3.md), [isxdigit(3)](/isxdigit/3.md), [isxdigit\_l(3)](/isxdigit_l/3.md), [xlocale(3)](/xlocale/3.md)
