Concept
What is the order of precedence and associativity of common C operators?
ComputerScienceOne / Comparing Strings and Characters
"16.1. Logical Operators Operator(s) Associativity Notes Highest ++ , -- left-to-right increment operators - , ! right-to-left unary negation operator, logical not * , / , % left-to-right + , - left-to-right addition, subtraction < , <= , > , >= left-to-right comparison == , != left-to-right equality, inequality && left-to-right logical And || left-to-right logical Or Lowest = , += , -= , *= , /= right-to-left assignment and compound assignment operators Table 16.3.: Operator Order of Precedence in C. Operators on the same level have equivalent order and are performed in the associative order specified. 16.1.1. Order of Precedence At this point it is worth summarizing the order of precedence of all the operators that we’ve seen so far including assignment, arithmetic, comparison, and logical. Since all of these operators could be used in one statement, for example, (b*b < 4*a*c || a == 0 || argc != 4) it is important to understand the order in which each one gets evaluated. Table 16.3 summarizes the order of precedence for the operators seen so far. This is not an exhaustive list of C operators."
Related Ideas
- What is the order of precedence and associativity of C operators?ComputerScienceOne · Order of Precedence
- How are comparison operators used with characters in C?ComputerScienceOne · Order of Precedence
- Why can’t numeric comparison operators be used to compare strings in C?ComputerScienceOne · Comparing Strings and Characters
- Why can numeric comparison operators not be used to compare strings in C?ComputerScienceOne · Order of Precedence
- Why can’t numeric comparison operators be used to compare strings in Java?ComputerScienceOne · Comparing Strings and Characters