char *_strupr(char *string); 将string中所有小写字母替换成相应的大写字母, 其它字符保持不变. 返回调整后的字符串的指针. char *_strlwr(char *string); 将string中所有大写字母替换成相应的小写字母, 其它字符保持不变. 返回调整后的字符串的指针.
#include <ctype.h> #include <stdio.h> int toupper(int c); /*变大写*/ int tolower(int c); /*变小写*/ void main(){ char c1,c2; c1='a'; c2='A'; printf("%c-%c",toupper(c1),tolower(c2));}
#include<stdio.h>#include<string.h>void ToLowerCase(char *s){ while(*s) { if(*s>='A'&&*s<='Z')*s='a'+(*s-'A'); ++s; }}void main(){ char s[80]; puts("输入字符串: "); gets(s); ToLowerCase(s); puts(s);}