在C语言中,可以使用标准库函数来判断字母是大写还是小写。以下是一种常用的方法:
#include <stdio.h>#include <ctype.h>int main() { char c = 'A'; if(isupper(c)) { printf("%c is uppercase.\n", c); } else if(islower(c)) { printf("%c is lowercase.\n", c); } else { printf("%c is not a letter.\n", c); } return 0;}在上面的代码中,我们使用isupper()和islower()函数来判断字符c是大写还是小写字母。如果是大写字母,则输出uppercase;如果是小写字母,则输出lowercase;如果不是字母,则输出not a letter。


