Concept
What is the order of precedence and associativity of C operators?
ComputerScienceOne / Order of Precedence
"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 common C operators?ComputerScienceOne · Comparing Strings and Characters
- What is the order of precedence and associativity of PHP operators?ComputerScienceOne · Order of Precedence
- How is operator precedence determined in Java?ComputerScienceOne · Order of Precedence
- What is the order of precedence for PHP operators?ComputerScienceOne · If, If-Else, If-Else-If Statements
- How does C handle arithmetic operators and integer division?ComputerScienceOne · Operators
- How do you access members through a pointer to a structure?ComputerScienceOne · Selection Operators
- How are if, if-else, and if-else-if statements written in C?ComputerScienceOne · If, If-Else, If-Else-If Statements
- Why can numeric comparison operators not be used to compare strings in C?ComputerScienceOne · Order of Precedence