Objective-C Operators

Objective-C operators, like those in other programming languages, let you perform operations on variables (hence the name). Objective-C provides many operators, and keeping track of all of them can be difficult as you program your iPhone or Mac OS X apps. Use the following tables to jog your memory as to which operator accomplishes what task.





























Arithmetic Operators
OperatorWhat It Does
+Addition
-Subtraction
*Multiplication
/Division
%Modulo
































Relational and Equality Operators
OperatorWhat It Does
==Equal to
!=Not equal to
>Greater than
<Less than
>=Greater than or equal to
<=Less than or equal to




















Logical Operators
OperatorWhat It Does
!NOT
&&Logical AND
||Logical OR
















































Compound Assignment Operators
OperatorWhat It Does
+=Addition
-=Subtraction
*=Multiplication
\/=Division
\%=Modulo
&=Bitwise AND
|=Bitwise Inclusive OR
^=Exclusive OR
<<=Shift Left
>>=Shift Right
















































Increment and Decrement Operators
OperatorWhat It Does
++Addition
--Subtraction
*=Multiplication
/=Division
%=Modulo
&=Bitwise AND
|=Bitwise Inclusive OR
^=Exclusive OR
<<=Shift Left
>>=Shift Right
































Bitwise Operators
OperatorWhat It Does
&Bitwise AND
|Bitwise Inclusive OR
^Exclusive OR
~Unary complement (bit inversion)
<<Shift Left
>>Shift Right
































Other operators
OperatorWhat It Does
()Cast
,Comma
Sizeof()Size of
? :Conditional
&Address
*Indirection



dummies

Source:http://www.dummies.com/how-to/content/objectivec-operators.html

No comments:

Post a Comment