Operator Precedence


The following tables show the order in which operators are evaluated. Please note the following.
Summary table.
Table in detail.

Operators listed by type.

Summary precedence table.

All operators on the same line have the same precedence. The first line has the highest precedence.

() [] -> .
! ~ ++ -- + - * & sizeof
* / %
+ -
<< >>
<=index.html >=index.html >
==index.html !=index.html
&
^
|
&&
||
?:
=index.html +=index.html -=index.html *=index.html /=index.html %=index.html &=index.html ^=index.html |=index.html <<=index.html >>=index.html
,


Detailed precedence table.

All operators in the same 'block' have the same precedence. The first block has the highest precedence.

GroupOperatorDescriptionExample
Membership.
()Function call.count =index.html function(4,3);
[]Array.value =index.html array[5] + increment;
->Structure pointer.
.Structure member.
Unary.
!Logical NOT
~
++Increment.
--Decrement.
+
-
*Pointer to data
&Address of a variable.
sizeof
(type)type cast.
Binary.
* Multiply.
/ Divide.
% Modulo.
Binary.
+ Addition
- Subtraction.
Bitwise
<< Shift left.
>> Shift Right.
Relational.
Less than.
> Greater than.
<=index.html Less than or equal too.
>=index.html Greater than or equal too.
==index.html Equal too.
!=index.html Not equal too.
More Bitwise
& bitwise AND
^ bitwise Excusive OR
| bitwise OR
Logical.
&& Logical AND
Logical.
|| Logical OR
Conditional
? : Conditional construct.
Assignment
=index.html Equals
+=index.html assignment
-=index.html assignment
*=index.html assignment
/=index.html assignment
%=index.html assignment
&=index.html assignment
^=index.html assignment
|=index.html assignment
<<=index.html assignment
>>=index.html assignment
Series
, Comma


See also:

Expressions and operators.
Assignment Operators.

Top Master Index Keywords Functions


Martin Leslie 15-Nov-95