Operators

Operators work like functions; however, their notation is different.

The following is a list of all available operators and their order of execution in any statement (priority). Following the table of operators shown below are detailed descriptions of each operator, including their usage and examples.

If you require further information on operators in statements or operator priority, please see Operators in Statements, and Operator Priority in Statements.

Note: When doing comparisons between two operands of different types, the second operand is always cast to the type of the first.  This can cause differing comparison results depending on the order of the operands.

 

Description

Symbol

Priority

Parentheses

( )

1

Scope Resolution

\

2

Array Index

[ ]

3

Segment/Offset

@

4

Logical NOT

~ or !

5

Unary Minus

-

5

Pointer Dereference

*

5

Address

&

5

Preincrement or Postincrement

++

5

Predecrement or Postdecrement

--

5

Multiplication

*

6

Division

/

6

Modulus

%

6

Addition/Concatenation

+

7

Subtraction

-

7

Right Shift

>> 

8

Left Shift

<< 

8

Less Than

9

Less Than or Equal To

<= or =<

9

Greater Than

9

Greater Than or Equal To

>= or =>

9

Equal To

==

10

Not Equal To

<> or >< or !=

10

Exclusive OR (XOR)

^

11

Logical AND

& or &&

12

Logical OR

| or ||

13

If Else

? :

14

Assignment

=

15

Add Equals

+=

15

Subtract Equals

-=

15

Multiply Equal

*=

15

Divide Equals

/=

15

Modulus Equals

%=

15

Topics in this section:

Alphabetical Listing of Operators