summaryrefslogtreecommitdiff
path: root/reference/C/CONCEPT/expressions.html
diff options
context:
space:
mode:
Diffstat (limited to 'reference/C/CONCEPT/expressions.html')
-rw-r--r--reference/C/CONCEPT/expressions.html135
1 files changed, 135 insertions, 0 deletions
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 @@
+<head>
+<title>C operators</title>
+</head>
+<body bgcolor="#ffffcc">
+<hr>
+<center>
+<h1>C Operators/Expressions</h1>
+</center>
+<hr>
+<p>
+
+Operators are used with
+<a href="../glossary.html#operand">operands</a>
+to build expressions. For example the
+following is an expression containing two operands and one oprator.
+
+<pre>
+ 4 + 5
+</pre>
+
+The following list of operators is probably not complete but does highlight
+the common
+operators and a few of the outrageous ones....
+<p>
+C contains the following operator groups.
+<ul>
+<li><a href="#arith">Arithmetic</a>
+<li><a href="#ass">Assignment</a>
+<li><a href="#rel">Logical/relational</a>
+<li><a href="#bit">Bitwise</a>
+<li><a href="#star">Odds and ends!</a>
+<p>
+<li><a href="precedence.html">Operator precedence table.</a>
+</ul>
+The order (precedence) that operators are evaluated can be seen
+<a href="precedence.html">here.</a>
+
+<h2><a name=arith>Arithmetic</h2>
+<pre>
+ +
+ -
+ /
+ *
+ % <a href="../EXAMPLES/modulo.c">modulo</a>
+ -- <a href="inc_dec.html">Decrement</a> (post and pre)
+ ++ <a href="inc_dec.html">Increment</a> (post and pre)
+</pre>
+<h2><a name=ass>Assignment</h2>
+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:
+<pre> counter = counter + 1; </pre>
+can be reduced to
+<pre> counter += 1; </pre>
+Here is the full set.
+<pre>
+ =
+ *= <a href="assignment.html">Multiply</a>
+ /= <a href="assignment.html">Divide.</a>
+ %= <a href="assignment.html">Modulus.</a>
+ += <a href="assignment.html">add.</a>
+ -= <a href="assignment.html">Subtract.</a>
+ <<= <a href="assignment.html">left shift.</a>
+ >>= <a href="assignment.html">Right shift.</a>
+ &= <a href="assignment.html">Bitwise AND.</a>
+ ^= <a href="assignment.html">bitwise exclusive OR (XOR).</a>
+ |= <a href="assignment.html">bitwise inclusive OR.</a>
+</pre>
+<h2><a name=rel>Logical/Relational</h2>
+<pre>
+ == Equal to
+ != Not equal to
+ >
+ <
+ >=
+ <=
+ && <a href="../SYNTAX/logical.html">Logical AND</a>
+ || <a href="../SYNTAX/logical.html">Logical OR</a>
+ ! <a href="../SYNTAX/logical.html">Logical NOT</a>
+</pre>
+<h2><a name=bit>Bitwise</h2>
+<pre>
+ & <a href="../CONCEPT/bitwise.html">AND (Binary operator)</a>
+ | <a href="../CONCEPT/bitwise.html">inclusive OR</a>
+ ^ <a href="../CONCEPT/bitwise.html">exclusive OR</a>
+ << <a href="../CONCEPT/bit_shift.html">shift left</a>. <font color=brown>C ++ use of <a href=../../CPLUSPLUS/SYNTAX/ops.html>&lt;&lt;</a></font>
+
+ >> <a href="../CONCEPT/bit_shift.html">shift right</a>. <font color=brown>C ++ use of <a href=../../CPLUSPLUS/SYNTAX/ops.html>&gt;&gt;</a></font>
+ ~ <a href="../CONCEPT/bitwise.html">one's complement</a>
+</pre>
+<a name=comma>
+<h2><a name=star>Odds and ends!</h2>
+<pre>
+ sizeof() <a href="../SYNTAX/sizeof.html">size</a> of objects and <a href="data_types.html">data types</a>.
+ <a href="../FUNCTIONS/strlen.html">strlen</a> may also be of interest.
+ & <a href="../EXAMPLES/address.c">Address of</a> (Unary operator)
+ * <a href="../EXAMPLES/address.c">pointer</a> (Unary operator)
+ ? <a href="../SYNTAX/conditional.html">Conditional expressions</a>
+ : <a href="../SYNTAX/conditional.html">Conditional expressions</a>
+ , <a href="../SYNTAX/comma.html">Series operator.</a>
+</pre>
+<hr>
+<p>
+<h2>C++ Extensions</h2>
+
+<font color=brown>
+Read about :: &gt;&gt; and &lt;&lt; in the world of C++
+<a href=../../CPLUSPLUS/SYNTAX/ops.html>here!</a>
+</font>
+<hr>
+<p>
+<center>
+<table border=2 width=80% bgcolor=ivory>
+<tr align=center>
+<td width=25%>
+<a href="../cref.html">Top</a>
+</td><td width=25%>
+<a href="../master_index.html">Master Index</a>
+</td><td width=25%>
+<a href="../SYNTAX/keywords.html">Keywords</a>
+</td><td width=25%>
+<a href="../FUNCTIONS/funcref.htm">Functions</a>
+</td>
+</tr>
+</table>
+</center>
+<p>
+
+<hr>
+<address>Martin Leslie
+<script language="JavaScript">
+<!-- //
+document.write(document.lastModified);
+// -->
+</script>
+</address>