Home  >  Article  >  Backend Development  >  What does uppercase stand for in c language

What does uppercase stand for in c language

下次还敢
下次还敢Original
2024-05-02 18:36:45352browse

In C language, uppercase characters are represented by characters with smaller ASCII code values. The toupper() function converts characters to uppercase, while the tolower() function converts them to lowercase. Other related functions include isupper(), islower(), strupper(), and strlower(), which are used to check character case and convert strings to uppercase or lowercase respectively.

What does uppercase stand for in c language

uppercase represents uppercase characters in C language

In C language, characters and strings are both Represented by ASCII code. The ASCII code value of uppercase characters and numbers is smaller than the corresponding lowercase characters and letters.

toupper() function

toupper() function converts uppercase characters to lowercase characters, and lowercase characters to uppercase characters. Its syntax is as follows:

<code class="c">int toupper(int ch);</code>

Where:

  • ch: The characters to be converted.
  • Return value: converted characters.

For example:

<code class="c">char ch = 'a';
toupper(ch); // ch 现在为 'A'</code>

tolower() function

tolower() function converts uppercase characters to lowercase characters, and lowercase characters to Uppercase characters. Its syntax is as follows:

<code class="c">int tolower(int ch);</code>

Where:

  • ch: The characters to be converted.
  • Return value: converted characters.

For example:

<code class="c">char ch = 'A';
tolower(ch); // ch 现在为 'a'</code>

Other related functions

C language also provides several other functions related to case conversion:

  • isupper(): Check whether the character is an uppercase character.
  • islower(): Check whether the character is lowercase.
  • strupper(): Converts all lowercase characters in the string to uppercase characters.
  • strlower(): Converts all uppercase characters in the string to lowercase characters.

The above is the detailed content of What does uppercase stand for in c language. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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