C 库函数 - toupper()

C 语言教程 · 2019-02-22 22:28:42

描述

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

声明

下面是 toupper() 函数的声明。

int toupper(int c);

参数

  • c -- 这是要被转换为大写的字母。

返回值

如果 c 有相对应的大写字母,则该函数返回 c 的大写字母,否则 c 保持不变。返回值是一个可被隐式转换为 char 类型的 int 值。

实例

下面的实例演示了 toupper() 函数的用法。

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

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

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

CODERCTO

点击查看所有 C 语言教程 文章: https://codercto.com/courses/l/17.html

查看所有标签

Open Data Structures

Open Data Structures

Pat Morin / AU Press / 2013-6 / USD 29.66

Offered as an introduction to the field of data structures and algorithms, Open Data Structures covers the implementation and analysis of data structures for sequences (lists), queues, priority queues......一起来看看 《Open Data Structures》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具