C语言 isupper()函数

isupper()函数

C语言中,ctype.h库中的isupper()函数判断字符是否是一个大写的字母。isupper()函数的语法如下:

int isupper(int c);

isupper()参数

参数描述
cint类型,比如'm'

isupper()返回值

如果参数是大写字母,返回非零值,否则返回0。

isupper()实例代码

如下实例,使用isupper()函数判断字符'M'和'n':

#include "stdio.h"
#include "ctype.h"


int main() {
    int upper_char = 'M';
    int lower_char = 'n';
    int t1 = isupper(upper_char);
    int t2 = isupper(lower_char);
    printf("%d\n",t1);
    printf("%d\n",t2);

    return 0;

}

免责声明:内容仅供参考,不保证正确性。


全栈后端 / C语言教程 :


















Copyright © 2022-2024 笨鸟工具 x1y1z1.com All Rights Reserved.