Home > Backend Development > C#.Net Tutorial > How to use toupper in C language

How to use toupper in C language

下次还敢
Release: 2024-05-02 18:36:14
Original
849 people have browsed it

toupper() function converts lowercase letters to uppercase letters. Syntax: int toupper(int c) Parameters: c - the character to be converted Return value: uppercase letter or c itself is only valid for letters in the ASCII character set locale-aware, the conversion may vary depending on the locale

How to use toupper in C language

Usage of toupper() function in C language

##Usage of toupper() function:

The toupper() function converts lowercase letters to uppercase letters.

Syntax:

<code class="c">int toupper(int c);</code>
Copy after login

Parameters:

    c: The characters to be converted.

Return value:

    If c is a lowercase letter, returns the uppercase version; otherwise, returns c itself.

Example:

<code class="c">char c = 'a';
char upper = toupper(c);

printf("小写字母 %c 的大写字母是 %c\n", c, upper);</code>
Copy after login

Output:

<code>小写字母 a 的大写字母是 A</code>
Copy after login

Notes:

    toupper() function is valid for letters in the ASCII character set.
  • For non-alphabetic characters, the toupper() function will not convert.
  • Thetoupper() function is locale-aware, which means that the conversion may vary depending on the current locale setting.

The above is the detailed content of How to use toupper in C language. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template