C isupper() 声明
int isupper(int argument);
isupper() 函数接受一个整数参数,并返回一个 `int` 类型的值。
尽管 isupper() 接受整数作为参数,但传递给函数的是字符。在内部,该字符会被转换为其 ASCII 值进行检查。
它定义在 `<ctype.h>` 头文件中。
C isupper() 的返回值
返回值 | 备注 |
---|---|
非零整数 ( x > 0 ) | 参数是大写字母。 |
零 (0) | 参数不是大写字母。 |
示例:C isupper() 函数
#include <stdio.h>
#include <ctype.h>
int main()
{
char c;
c = 'C';
printf("Return value when uppercase character %c is passed to isupper(): %d", c, isupper(c));
c = '+';
printf("\nReturn value when another character %c is passed to is isupper(): %d", c, isupper(c));
return 0;
}
输出
Return value when uppercase character C is passed to isupper(): 1 Return value when another character + is passed to is isupper(): 0
注意: 在您的系统上,当传递大写字母给 isupper() 时,您可能会得到不同的整数值。但是,当您向 isupper() 传递任何非大写字母时,它总是返回 0。