函数说明
对于大写字母,如果在当前语言环境中存在小写表示形式,则tolower()返回其小写等效物。否则,tolower()函数执行相同的任务。
函数声明
#include <ctype.h>
int tolower(int c);
函数返回值
返回的值是转换后的字母,如果不能转换则返回输入的字符。
函数实现
#define __C_tolower(c) (__C_isupper(c) ? ((c) | 0x20) : (c))
int tolower(int c)
{
return __C_tolower(c);
}
函数实例
#include <stdio.h>
#include <ctype.h>
int main()
{
int i = 0;
char *str = "ASEDyyds";
while(str[i])
{
printf("%c",tolower(*(str+i)));
i++;
}
printf("\n");
return 0;
}
输出
asedyyds