Concept
How are comparison operators used with characters in C?
ComputerScienceOne / Order of Precedence
"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"
Related Ideas
- How can comparison operators be used with characters in C?ComputerScienceOne · Comparing Strings and Characters
- What do character comparison results show in C?ComputerScienceOne · If, If-Else, If-Else-If Statements
- Why can’t numeric comparison operators be used to compare strings in C?ComputerScienceOne · Comparing Strings and Characters
- What primitive types does C support?ComputerScienceOne · Declaration & Assignment
- Why can’t numerical comparison operators be used to compare strings in C?ComputerScienceOne · Comparisons
- How does strcmp() compare the contents of two strings in C?ComputerScienceOne · Comparisons
- How are if, if-else, and if-else-if statements written in C?ComputerScienceOne · If, If-Else, If-Else-If Statements
- What is the order of precedence and associativity of common C operators?ComputerScienceOne · Comparing Strings and Characters