You’ll want to use the isalpha()
and isdigit()
standard functions in <ctype.h>
.
char c="a"; // or whatever
if (isalpha(c)) {
puts("it's a letter");
} else if (isdigit(c)) {
puts("it's a digit");
} else {
puts("something else?");
}
More Related Contents:
- Removing digits and all punctuation except apostrophe from a string in C
- How to write character to an array of pointers in C? [closed]
- Malloc , Realloc , Memset : Struct pointers , arrays of char, int
- Pointers and char[] in C [closed]
- char c[]=”Albus”; printf(“%c”, c); [closed]
- How to resolve a variable for char length? [closed]
- What is the difference between char s[] and char *s?
- Returning an array using C
- Is char guaranteed to be exactly 8-bit long? [duplicate]
- Is CHAR_BIT ever > 8?
- How to convert char to integer in C? [duplicate]
- size of character array and size of character pointer
- C char array initialization
- Why does strchr take an int for the char to be found?
- In C, why is sizeof(char) 1, when ‘a’ is an int?
- No compiler error when fixed size char array is initialized without enough room for null terminator
- Return char[]/string from a function [duplicate]
- In C, why can’t an integer value be assigned to an int* the same way a string value can be assigned to a char*?
- How does c compare character variable against string?
- Where in memory are string literals ? stack / heap? [duplicate]
- Convert char array to a int number in C
- Why does char* cause undefined behaviour while char[] doesn’t?
- C char array initialization: what happens if there are less characters in the string literal than the array size?
- Does C have a string type? [closed]
- assigning more than one character in char
- Get index of substring
- Reading newline from previous input when reading from keyboard with scanf()
- problems with char array = char array
- Assigning char array a value in C
- How many chars can be in a char array?