您的位置:首页 > 博客中心 > 编程语言 >

C语言常用函数-toupper()将字符转换为大写英文字母函数

时间:2022-09-07 11:14

演示版本

VS2013

  • toupper()函数

toupper()函数用于把小写字母转换为大写字母,不是小写字母的不变。

语法

int toupper(int ch);

toupper()函数的语法参数说明如下:

参数ch为待转换的字符。

toupper()函数的返回值:转换后的字符。

示例

本示例演示用toupper()函数把小写字母转换为大写字母。其具体代码如下:

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

int main()
{
    char ch1, ch2;
    printf("input a character\n");
    scanf_s("%c", &ch1);
    ch2 = toupper(ch1);
    printf("transform %c to %c\n", ch1, ch2);

    return 0;
}

技术图片

 

阿飞

2021年7月28日

本类排行

今日推荐

热门手游