Bifalgorithm post · Computer science one · Order of Precedence

How are comparison operators used with characters in C?

How are comparison operators used with characters in C? (Computer science one · Order of Precedence) — "16.1.2. Comparing Strings and Characters The comparison…

Ideas in this flowchart

  • Comparing strings and characters
  • Comparison operators can be used for single characters.
  • ASCII assigns each alphanumeric character, symbol, and whitespace character an integer from 0 to 127.
  • Character comparisons use the numerical order of their ASCII values.
  • The statement ('A' < 'a') is true.
  • Uppercase letters precede lowercase letters in the ASCII table.
  • 'A' has value 65 and 'a' has value 97, so 65 < 97 is true.
  • The comparison operators are listed in Table 16.1.
  • The ASCII ordering is shown in Table 2.4.
  • Additional comparison examples can be found in the table.
Feed/

How are comparison operators used with characters in C?

No cover

Channel

Computer science one

1 page

"16.1.2. Comparing Strings and Characters The comparison operators in Table 16.1 can also be used for single characters because of the nature of the ASCII text table (see Table 2.4). Each alphanumeric character, including the various symbols and whitespace characters, is associated with an integer 0–127. We can therefore write statements like ('A' < 'a'), which is true since uppercase letters are ordered before lowercase letters in the ASCII table ('A' is 65 and 'a' is 97 and so 65 < 97 is true). Several more examples can be found in Table"

Flowchart preview
👍
0
0 comments0 shares

Sign in to view and post comments.