Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Saturday, March 14, 2015

What is operator precedence ?

The precedence of an operator is the priority or the value (level) of the operator. Precedence decides the evaluation of the operators i.e. operators which has higher level of precedence are evaluated first.
Priority
Operator
Associativity
Description

()
Left to Right
Function expression
1
[]

Array element reference

->

Structure operator

.

Structure operator (pointer)

-
Right to Left
Unary minus

+

Unary plus

--

Decrement

++

Increment
2
~

One’s complement

!

Logical negation (NOT)

*

Indirection (reference)

&

Address

(type)

Type conversion (type cast)

Sizeof

Size of an operand in byte’s

/
Left to Right
Division
3
*

Multiplication

%

Modulus
4
+
Left to Right
Addition

-

Subtraction
5
<< 
Left to Right
Bitwise left shift

>> 

Bitwise right shift

> 
Left to Right
Greater than
6
>=

Greater than or equal to

< 

Less than

<=

Less than or equal to
7
==
Left to Right
Equal to

!=

Not equal to
8
&
Left to right
Bitwise AND
9
^
Left to right
Bitwise XOR
10
|
Left to right
Bitwise OR
11
&&
Left to right
Logical AND
12
||
Left to right
Logical OR
13
?:
Right to left
Conditional
14
=
*=
/=
%=
+=
 -=
&=
^=
|=
<<=
 >>=
Right to left
Assignment


No comments:

Post a Comment