toupper() - C函数

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

声明

以下是与toupper()函数的声明。

int toupper(int c);

参数

  • c -- 这是字母将转换为大写。

返回值

该函数等效返回大写字母C,如果存在这样的值,否则c保持不变。返回值可以隐式转换为char的int值。

例子

下面的例子显示了toupper()函数的用法。

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

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

让我们编译和运行上面的程序,这将产生以下结果:

zaixian POINT

上一篇: tolower() - C函数 下一篇: <errno.h> - C语言标准库