#include <ctype.h>
int tolower( int ch );
将字符 ch 的转换成小写字符。
#include <string.h> #include <stdio.h> #include <ctype.h> int main(void) { int length, i; char *string = "THIS IS A STRING"; length = strlen(string); for (i=0; i<length; i++) { printf("%c", tolower(string[i])); } printf("\n"); return 0; }
输出结果:
this is a string