c check if character is lower case
Checking if a Character is Lower Case in C
To check if a character is lowercase in C, you can use the islower()
function from the ctype.h
library. This function takes an integer representing a character as an argument and returns a non-zero value if the character is a lowercase letter.
Here's an example of how you can use the islower()
function in C:
#include <stdio.h>
#include <ctype.h>
int main() {
char ch = 'a';
if (islower(ch)) {
printf("%c is a lowercase letter\n", ch);
} else {
printf("%c is not a lowercase letter\n", ch);
}
return 0;
}
In this example, the islower()
function is used to check if the character 'a' is a lowercase letter. If it is, the program will print that 'a' is a lowercase letter.
[[SOURCE #1]]