天天看点

int toupper(int c) 把小写字母转换为大写字母

C 库函数 int toupper(int c) 把小写字母转换为大写字母。

如果 c 有相对应的大写字母,则该函数返回 c 的大写字母,否则 c 保持不变。

返回值是一个可被隐式转换为 char 类型的 int 值。

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

int main()
{
   int i = 0;
   char c;
   char str[] = "runoob";
   
   while(str[i])
   {
      putchar (toupper(str[i]));
      i++;
   }

  return(0);
}
           

继续阅读