.TH operator "" "" Definition
.PC
.PP
An
.B operator
is a function that is built into the C language.
It usually relates one operand to another.
For example, the statement
.DM
	1+2
.DE
.PP
relates the operands
\fB1\fR and \fB2\fR through the operation of addition;
on the other hand, the statement
.DM
	A>B
.DE
.PP
relates the operands
\fBA\fR and \fBB\fR logically, by asserting that the former
is greater than the latter; whereas
.DM
	A=B
.DE
.PP
relates the operands \fBA\fR and \fBB\fR
by assigning the value of the latter to the former.
The following is a table of the C operators:
.nf
.sp \n(pDu
.ta 0.4i 1.2i
	*	Multiplication
	/	Division
	%	Remainder
	+	Addition
	-	Subtraction
.sp \n(pDu
	<	Less than
	<=	Less than or equal to
	>	Greater than
	>=	Greater than or equal to
.sp \n(pDu
	&&	Logical AND
	!=	Inequality
	!	Logical negation
	|\ |	logical OR
.sp \n(pDu
	&	Bitwise AND
	^	Bitwise exclusive OR
	~	Bitwise complement
	|	Bitwise inclusive OR
	<<	Bitwise shift left
	>>	Bitwise shift right
.sp \n(pDu
	=	Assign
	+=	Increment and assign
	\-=	Decrement and assign
	*=	Multiply and assign
	/=	Divide and assign
	%=	Modulus and assign
	++	Increment
	--	Decrement
	==	Equivalence
	&=	Bitwise AND and assign
	^=	Bitwise exclusive OR and assign
	|=	Bitwise inclusive OR and assign
	<<=	Bitwise shift left and assign
	>>=	Bitwise shift right and assign
.sp \n(pDu
	*	Indirection
	&	Render an address
	()	Function indicator
	[]	Array indicator
	->	Structure pointer
	.	Structure member
	?\ :	Conditional expression
.sp \n(pDu
	\fBsizeof\fR	size of an object
.fi
.SH Precedence
.II operator^precedence
.II precedence, operators
.I Precedence
refers to the order in which C executes operators.
The C languages assigns a level of precedence to each operator.
Operators are executed in the order of their precedence level,
from highest to lowest.
.PP
The following table summarizes the precedence of C operators.
The are listed in \fIdescending\fR order of precedence:
those listed higher in the table are executed before those lower in
the table.
Operators listed on the same line have the same level of precedence, and
the implementation determines the order in which they are executed.
If you use two or more such operators in the same expression, you would
be wise to use parentheses to indicate exactly the order in which you
want the operators executed.
.B1
.ta 0.4i 3.75i
	\fIOperator	Associativity\fP
.sp \n(pDu
	()   []   ->   .	\fRLeft to right\fP
.sp \n(pDu
	!  ~  ++  --  -  (\fItype\^\fP)  *  &  sizeof	\fRRight to left\fP
.sp \n(pDu
	*  /  %	\fRLeft to right\fP
.sp \n(pDu
	+  -	\fRLeft to right\fP
.sp \n(pDu
	<<  >>	\fRLeft to right\fP
.sp \n(pDu
	<  <=  >  >=	\fRLeft to right\fP
.sp \n(pDu
	==  !=	\fRLeft to right\fP
.sp \n(pDu
	&	\fRLeft to right\fP
.sp \n(pDu
	^	\fRLeft to right\fP
.sp \n(pDu
	|	\fRLeft to right\fP
.sp \n(pDu
	&&	\fRLeft to right\fP
.sp \n(pDu
	||	\fRLeft to right\fP
.sp \n(pDu
	?:	\fRRight to left\fP
.sp \n(pDu
	=  +=  -=  *=  /=  %=	\fRRight to left\fP
.sp \n(pDu
	,	\fRLeft to right\fP
.B2
.PP
You can always determine precedence in an expression by
enclosing sub-expressions within parentheses:
the expression enclosed within the innermost parentheses is
always executed first.
.SH "See Also"
.Xr "Programming COHERENT," programmi
.Xr "sizeof" sizeof
.br
\*(AS, \(sc6.1, \(sc6.3
