VOOZH about

URL: https://www.geeksforgeeks.org/c/isxdigit-function-c-language/

⇱ isxdigit() function in C Language - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

isxdigit() function in C Language

Last Updated : 2 Nov, 2022

isxdigit() function in C programming language checks that whether the given character is hexadecimal or not. isxdigit() function is defined in ctype.h header file. Hexadecimal equivalent of Decimal Numbers:

Hexadecimal: 0 1 2 3 4 5 6 7 8 9 A B C D E F
Decimal: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Syntax:

char isxdigit( char x);

Examples:

Input : A
Output : Entered character is hexadecimal
Input : 2
Output : Entered character is hexadecimal
Input : @
Output : Entered character is not hexadecimal

Output:

Entered character is hexadecimal

Application : isxdigit() function in C programming language is used to find out total numbers of hexadecimals present in any given input. Example:

Input: abc123
Output: Number of hexadecimals present in the given input is : 6
Input: abcdef
Output: Number of hexadecimals present in the given input is : 6
Input: 123456@$
Output: Number of hexadecimals present in the given input is : 6

Let's see C program on this topic: 

Output:

Number of hexadecimals in string is : 7
Comment
Article Tags: