From 7e0f021a9aec35fd8e6725e87e3313b101d26f5e Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Sun, 27 Jan 2008 11:37:44 +0100 Subject: Initial import (2.0.2-6) --- reference/C/CONCEPT/expressions.html | 135 +++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 reference/C/CONCEPT/expressions.html (limited to 'reference/C/CONCEPT/expressions.html') diff --git a/reference/C/CONCEPT/expressions.html b/reference/C/CONCEPT/expressions.html new file mode 100644 index 0000000..a3dac05 --- /dev/null +++ b/reference/C/CONCEPT/expressions.html @@ -0,0 +1,135 @@ + +C operators + + +
+
+

C Operators/Expressions

+
+
+

+ +Operators are used with +operands +to build expressions. For example the +following is an expression containing two operands and one oprator. + +

+        4 + 5
+
+ +The following list of operators is probably not complete but does highlight +the common +operators and a few of the outrageous ones.... +

+C contains the following operator groups. +

+The order (precedence) that operators are evaluated can be seen +here. + +

Arithmetic

+
+        +
+        -
+        /
+        *
+        %       modulo
+        --      Decrement (post and pre)
+        ++      Increment (post and pre)
+
+

Assignment

+These all perform an arithmetic operation on the lvalue and assign the +result to the lvalue. So what does this mean in English? Here is an example: +
   counter = counter + 1; 
+can be reduced to +
   counter += 1;           
+Here is the full set. +
+        =
+        *=      Multiply
+        /=      Divide.
+        %=      Modulus.
+        +=      add.
+        -=      Subtract.
+        <<=     left shift.
+        >>=     Right shift.
+        &=      Bitwise AND.
+        ^=      bitwise exclusive OR (XOR).
+        |=      bitwise inclusive OR.
+
+

Logical/Relational

+
+        ==      Equal to
+        !=      Not equal to
+        >
+        <
+        >=
+        <=
+        &&      Logical AND
+        ||      Logical OR
+        !       Logical NOT
+
+

Bitwise

+
+        &       AND (Binary operator)
+        |       inclusive OR
+        ^       exclusive OR
+        <<      shift left. C ++ use of <<
+
+        >>      shift right. C ++ use of >>
+        ~       one's complement
+
+ +

Odds and ends!

+
+        sizeof() size of objects and data types.
+                 strlen may also be of interest.
+        &       Address of (Unary operator)
+        *       pointer (Unary operator)
+        ?       Conditional expressions
+        :       Conditional expressions
+        ,       Series operator.
+
+
+

+

C++ Extensions

+ + +Read about :: >> and << in the world of C++ +here! + +
+

+

+ + + + +
+Top + +Master Index + +Keywords + +Functions +
+
+

+ +


+
Martin Leslie + +
-- cgit v1.2.3-54-g00ecf