10.01.2011

Operator

Assignment Operator:


OperatorDescriptionExample
=Simple assignment operator, Assigns values from right side operands to left side operandC = A + B will assigne value of A + B into C
+=Add AND assignment operator, It adds right operand to the left operand and assign the result to left operandC += A is equivalent to C = C + A
-=Subtract AND assignment operator, It subtracts right operand from the left operand and assign the result to left operandC -= A is equivalent to C = C - A
*=Multiply AND assignment operator, It multiplies right operand with the left operand and assign the result to left operandC *= A is equivalent to C = C * A
/=Divide AND assignment operator, It divides left operand with the right operand and assign the result to left operandC /= A is equivalent to C = C / A
%=Modulus AND assignment operator, It takes modulus using two operands and assign the result to left operandC %= A is equivalent to C = C % A
<<=Left shift AND assignment operatorC <<= 2 is same as C = C << 2
>>=Right shift AND assignment operatorC >>= 2 is same as C = C >> 2
&=Bitwise AND assignment operatorC &= 2 is same as C = C & 2
^=bitwise exclusive OR and assignment operatorC ^= 2 is same as C = C ^ 2
|=bitwise inclusive OR and assignment operatorC |= 2 is same as C = C | 2




Bitwise Operator



OperatorDescriptionExample
&Binary AND Operator copies a bit to the result if it exists in both operands.(A & B) will give 12 which is 0000 1100
|Binary OR Operator copies a bit if it exists in eather operand.(A | B) will give 61 which is 0011 1101
^Binary XOR Operator copies the bit if it is set in one operand but not both.(A ^ B) will give 49 which is 0011 0001
~Binary Ones Complement Operator is unary and has the efect of 'flipping' bits.(~A ) will give -60 which is 1100 0011
<<Binary Left Shift Operator. The left operands value is moved left by the number of bits specified by the right operand.A << 2 will give 240 which is 1111 0000
>>Binary Right Shift Operator. The left operands value is moved right by the number of bits specified by the right operand.A >> 

Binary Operator

,
Comma
Binary
!=
Inequality
Binary
%
Modulus
Binary
%=
Modulus assignment
Binary
&
Bitwise AND
Binary
&&
Logical AND
Binary
&=
Bitwise AND assignment
Binary
*
Multiplication
Binary
*=
Multiplication assignment
Binary
+
Addition
Binary
+=
Addition assignment
Binary
Subtraction
Binary
–=
Subtraction assignment
Binary
–>
Member selection
Binary
–>*
Pointer-to-member selection
Binary
/
Division
Binary
/=
Division assignment
Binary
<
Less than
Binary
<<
Left shift
Binary
<<=
Left shift assignment
Binary
<=
Less than or equal to
Binary
=
Assignment
Binary
==
Equality
Binary
>
Greater than
Binary
>=
Greater than or equal to
Binary
>>
Right shift
Binary
>>=
Right shift assignment
Binary
^
Exclusive OR
Binary
^=
Exclusive OR assignment
Binary
|
Bitwise inclusive OR
Binary
|=
Bitwise inclusive OR assignment
Binary
||
Logical OR
Binary
sumber:

No comments:

Post a Comment

Tulisan 1 baris Anda akan sangat memotivasi saya untuk menulis 1 halaman artikel lagi.