toupper 将字符转换成大写字符

头文件

#include <ctype.h>

语法

 int toupper( int ch );

功能

把字符 ch 转换成大写字母。

示例

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

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

   length = strlen(string);
   for (i=0; i<length; i++)
   {
       printf("%c", toupper(string[i]));
   }

   return 0;
}

输出结果:

THIS IS A STRING
关于
本网站属于个人的非赢利性网站,转载的文章遵循原作者的版权声明,如果原文没有版权声明,请来信告知:hxstrive@outlook.com
公众号