Operator Precedence
Evaluation order.
Why Precedence Matters
Precedence decides which operator runs first in an expression with several operators. It mirrors normal math: multiplication before addition.
#include <stdio.h>
int main(void) {
printf("%d\n", 2 + 3 * 4);
return 0;
}Parentheses Override
Parentheses force evaluation order. Use them to make intent clear and override defaults.
#include <stdio.h>
int main(void) {
printf("%d\n", (2 + 3) * 4);
return 0;
}All lessons in this course
- Arithmetic Operators
- Relational and Logical
- Assignment and Increment
- Operator Precedence