Online Reference

 

 

C REFERENCE
RAPID TABLES

 

 

    Home > Programming > C Reference > Operators

C Operators

List of C operators with their symbol, syntax and precedence.

Table of C Operators

SymbolSyntaxNamePrecedence
[][x]brackets1
()(x)parenthesis1
->

p->member

structure member (from pointer)1
.x.memberstructure member1
 
++++xprefix increment2
----xprefix decrement2
++x++postfix increment2
--x--postfix decrement2
&&xvariable address2
**ppointer indirection2
sizeof()sizeof(x)size of variable in bytes2
(type)(type)xtype cast2
~~xbitwise NOT2
!!xlogical NOT2
++xunary plus2
--xunary minus2
 
*x*ymultiplication3
/x/ydivision3
%x%ymodulus (integer)3
 
+x+yaddition4
-x-ysubtraction4
 
<<x<<yleft shift5
>>x>>yright shift5
 
>x>ygreater than6
>=x>=ygreater than or equal6
<x<ysmaller than6
<=x<=ysmaller than or equal6
 
==x==ycomparison - equal to7
!=x!=ycomparison - not equal to7
 
&x&ybitwise AND8
 
^x^ybitwise XOR9
 
|x|ybitwise  OR10
 
&&x&&ylogical AND11
 
||x||ylogical OR12
 
?:C ? T : FConditional expression13
 
=x=yassignment operator14
+=x+=yaddition and assignment14
-=x-=ysubtraction and assignment14
*=x*=ymultiplication and assignment14
/=x/=ydivision and assignment14
%=x%=ymodulus  and assignment14
&=x&=ybitwise AND and assignment14
|=x|=ybitwise OR and assignment14
^=x^=ybitwise XOR and assignment14
>>=x>>=yright shift and assignment14
<<=x<<=yleft shift and assignment14
 
,x,yComma - expressions separator15

 

Syntax:        x,y denotes a variable or expression.

                  p denotes a pointer.

Precedence: 1 is the highest.

 

© 2006-2008 RapidTables.com