Operator Precedence - C Operator

C examples for Operator:Operator Basics

Introduction

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,

Demo Code

#include <stdio.h>
int main(void) {
   int x = 4 + 3 * 2; /* 10 */

   x = 4 + (3 * 2); /* 10 */
}

Related Tutorials