Press "Enter" to skip to content

标签: 小写

c 字符串小写转大写

常用的C小写字母转大写程序

#include <stdio.h>
int main(void)
    {
          int i=0;
          char string[100];
          strcpy(string,"abcdefghijklmnopqrstuvwxyz");
     while (string[i]!='\0'){ //将小写转化成大写
                  if (islower(string[i]))
                      string[i]=toupper(string[i]);
           i++;
       }
       printf("%s\n",string);
       return 0;
    }  

输出:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
Leave a Comment