C语言字符函数

C语言 islower()函数用于判断一个字符是否为小写。它是C语言的字符函数之一,位于标准库<ctype.h>中。

语法

语法如下:
int islower(int c)

    参数

    • c:指定要判断的字符。

    功能

    判断一个字符c是否为英文小写

    返回值

    当c为小写英文字母(a-z)时,返回非零值,否则返回零。

    程序示例

    介绍一个例子,了解C语言 islower()函数的使用方法。

    #include <ctype.h> 
    #include <stdio.h> 
      
    int main() 
    { 
        char c;
        c='y';
        printf("%c:%s\n",c,islower(c)?"是英文小写":"不是");
        c='Y';
        printf("%c:%s\n",c,islower(c)?"是英文小写":"不是");
        c='3';
        printf("%c:%s\n",c,islower(c)?"是英文小写":"不是");
        c='@';
        printf("%c:%s\n",c,islower(c)?"是英文小写":"不是");
        return 0; 
    }
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15

    程序运行结果:

    y:是英文小写
    Y:不是
    3:不是
    @:不是