Bifalgorithm post · Computer science one · Comparing Strings and Characters

How can comparison operators be used with characters in C?

How can comparison operators be used with characters in C? (Computer science one · Comparing Strings and Characters) — "16.1.2. Comparing Strings and Character…

Ideas in this flowchart

  • Comparing strings and characters
  • Comparison operators can be used for single characters
  • Character comparison depends on the ASCII text table
  • Each alphanumeric character, symbol, and whitespace character has an associated integer
  • ASCII character codes range from 0 to 127
  • The expression ('A' < 'a') is true
  • Uppercase letters are ordered before lowercase letters in ASCII
  • 'A' has code 65 and 'a' has code 97
  • Because 65 < 97, the character comparison is true
  • Additional comparison examples are provided in a table
Feed/

How can comparison operators be 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.