tolower()函數(shù)將大寫字母轉(zhuǎn)換為小寫字符。
如果傳遞給tolower()函數(shù)的參數(shù)不是大寫字母,則它返回傳遞給該函數(shù)的相同字符。
它在ctype.h 頭文件中定義。
int tolower(int argument);
在C編程中,字符以整數(shù)形式存儲。當字符作為參數(shù)傳遞時,將傳遞該字符的相應ASCII值(整數(shù)),而不是該字符本身。
#include <stdio.h>
#include <ctype.h>
int main()
{
char c, result;
c = 'M';
result = tolower(c);
printf("tolower(%c) = %c\n", c, result);
c = 'm';
result = tolower(c);
printf("tolower(%c) = %c\n", c, result);
c = '+';
result = tolower(c);
printf("tolower(%c) = %c\n", c, result);
return 0;
}輸出結(jié)果
tolower(M) = m tolower(m) = m tolower(+) = +