c语言函数tolower()怎么把大写字母转换为小写字母



c语言函数tolower()怎么把大写字母转换为小写字母?相关函数实例源码介绍,需要引入的头文件:#include <stdlib.h>

定义函数:int tolower(int c);

tolower()函数介绍:若参数 c 为大写字母则将该对应的小写字母返回。

tolower()函数返回值:返回转换后的小写字母,若不须转换则将参数c 值返回。

tolower()函数实例源码介绍:将s 字符串内的大写字母转换成小写字母。

#include <ctype.h>
main(){
    char s[] = "aBcDeFgH12345;!#$";
    int i;
    printf("before tolower() : %s\n", s);
    for(i = 0; i < sizeof(s); i++)
        s[i] = tolower(s[i]);
    printf("after tolower() : %s\n", s);
}

tolower()执行结果:
before tolower() : aBcDeFgH12345;!#$
after tolower() : abcdefgh12345;!#$