C语言转换字符串为大写和小写
#include <ctype.h> /* * Convert a string to lowercase */ char *lc(char *str) { char *t; for (t = str; *t; t++) { /* Convert to lowercase */ (*t) = tolower(*t); } /* Done */ return (str); } /* * Convert a string to uppercase */ char *uc(char *str) { char *t; for (t = str; *t; t++) { /* Convert to uppercase */ (*t) = toupper(*t); } /* Done */ return (str); }