tolower()函数是C语言中的一种字符串函数,它的作用是把字符串中的所有大写字母转换成小写字母。
使用方法
tolower()函数的原型为:
int tolower(int c);
它接收一个int型参数,如果参数是大写字母,返回值是小写字母,如果参数不是大写字母,返回值和参数值相同。
下面是使用tolower()函数的一个示例:
#include#include int main() { char str[] = "Hello World!"; int i; for (i = 0; str[i]; i++) str[i] = tolower(str[i]); printf("%s\n", str); return 0; }
编译运行上面的程序,输出结果为:
hello world!
从上面的示例可以看出,tolower()函数可以把字符串中的所有大写字母转换成小写字母。
tolower()函数是C语言中的一种字符串函数,它的作用是把字符串中的所有大写字母转换成小写字母。它接收一个int型参数,如果参数是大写字母,返回值是小写字母,如果参数不是大写字母,返回值和参数值相同。