Keil Logo


#include <ctype.h>

int toint (
  int c);   /* digit to convert */

The toint function interprets c as a single-digit hexadecimal value. ASCII characters '0'-'9' generate values 0-9. ASCII characters 'A'-'F' and 'a'-'f' generate values 10-15. If the value of c is not a hexadecimal digit, the function returns –1.

Return Value

The toint function returns the value of the ASCII hexadecimal character c.

See Also


#include <ctype.h>
#include <stdio.h> /* for getchar */

void tst_toint (void) {
  unsigned long l;
  unsigned char k;

  for (l = 0; isdigit (k = getchar ()); l *= 10) {
    l += toint (k);
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.