Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

operators priority in c

/* First priority (left-to-right) */
v++ v--       // increment/decrement suffix
() []         // function call / array subscripting
.  ->         // structure and union member access (trought pointer or not)
(type) {list} // Compond literal

/* priority 2 (right-to left) */
++v --v       // increment/decrement prefixe
+ -           // unary plus/minus
! ~           // logical and bitwise NOT
(type)        // type casting
* &           // dereference / adress-of
sizeof _Alignof

/* (left-to right) */
// priority 3
* / %
// priority 4
+ -
// priority 5
>> <<
// priority 6
< <= > >=
// priority 7
== !=
// priority 8
&
// priority 9
^
// priority 10
|
// priority 11
&&
// priority 12
||

// (right-to-left)
// priority 13
? :             // ternary conditional
// priority 14
= += -= *= /= %= <<= >>= &= ^= |= ~=

// (left-to-right) 
// priority 15
,
Source by en.cppreference.com #
 
PREVIOUS NEXT
Tagged: #operators #priority
ADD COMMENT
Topic
Name
9+7 =