c语言 字符串转大写的简单实例

 更新时间:2020年4月25日 17:43  点击:1858

复制代码 代码如下:

#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>

int main(void)
{
   int length, i;
   char string[20]= "this is a string";

   length = strlen(string);
   for (i=0; i<length; i++)
   {
      string[i] = toupper(string[i]);
   }

   printf("%s\n",string);
   system("pause");  
   return 0;
}

[!--infotagslink--]

相关文章