C examples for Operator:Operator Basics
In C, expressions are normally evaluated from left to right.
The precedence of those operators decides the order of evaluation.
Pre | Operator | Pre | Operator |
---|---|---|---|
1 | () [] . -> x++ x-- | 8 | & |
2 | ! ~ ++x --x (type) sizeof * & | 9 | ^ |
3 | * / % | 10 | | |
4 | + - | 11 | && |
5 | << >> | 12 | || |
6 | < <= > >= | 13 | = op= |
7 | == != | 14 | , |
#include <stdio.h> int main(void) { int x = 4 + 3 * 2; /* 10 */ x = 4 + (3 * 2); /* 10 */ }