C语言转换字符串为大写和小写

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

#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); 
}