EnglishРусский  

Ads

Installer and installation software
Commercial and Freeware installers.

Arithmetic operators

There are three groups of arithmetic operators.

Arithmetic operators

+Addition. 10 + 34 = 44
-Subtraction. 100 - 25 = 75
*Multiplication. 11 * 5 = 55
/Division. Dividing one integer into another, any fractional portion is truncated. 10 / 3 = 3
%Residue of division. The operation a % b returns the remainder (modulus) obtained by dividing a into b or 0, if result is a whole number. The modulus operator % is only used to perform division of two integers. 14 % 4 = 2
-(un)Unary negation operator. This operation change a sign of integer or decimal numbers. -10 = -10

a = ( 54 + b ) * (( 2*c - 235 ) / 3 )
b =  a % 10 + 0xFF00

Increment and decrement operators

The operators ++ and -- are unary operators and deal with only integers.

++The increment operator. This operator is expressed in two notations: the prefix-form ++i and the postfix form i++. In the prefix form, variable i is incremented by the integer value 1, new value of variable i is used in the expression evaluation; in the postfix form, the increment takes place after the value of variable i is used in the expression evaluation.
--The decrement operator. The prefix notation is --i - the variable is decremented by one and the result is this decremented value. The postfix notation is i-- - the decrement occurs after the value of variable is used in expression evaluation.

i = ++k
while i++ < 100
{
   sum += l--
}

Bitwise operators

These bitwise operators perform manipulation on integer operands.

&Bitwise-AND (binary). 0x124 & 0x107 = 0x104
)
^Bitwise-exclusive-OR (binary). 0x124 ^ 0x107 = 0x23
<<Bitwise shift left (binary). The bitwise shift operators shift their left operand left or right by the number of positions the right operand specifies, bits vacated by the shift operation are zero-filled. 0x124 << 2 = 0x490
>>Bitwise shift right (binary). 0x124 >> 2 = 0x92
~Bitwise negation (unary). ~0x124 = 0xFFFFFEDB

a = b & 0x0020 + с | $FLAG_CHECK
rand=( 16807 * rand ) % 0x7FFFFFFF ) % ( end - begin + 1 ) + begin

You can define these operators for any types. See more details on the Redefining operator operations page.

Related links