summaryrefslogtreecommitdiff
path: root/reference/C/CONCEPT/true_false.html
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2008-01-27 11:37:44 +0100
committerTobias Klauser <tklauser@xenon.tklauser.home>2008-01-27 11:37:44 +0100
commit7e0f021a9aec35fd8e6725e87e3313b101d26f5e (patch)
treeb1cacc4b24393f517aeb4610e9e1021f954307a8 /reference/C/CONCEPT/true_false.html
Initial import (2.0.2-6)2.0.2-6
Diffstat (limited to 'reference/C/CONCEPT/true_false.html')
-rw-r--r--reference/C/CONCEPT/true_false.html78
1 files changed, 78 insertions, 0 deletions
diff --git a/reference/C/CONCEPT/true_false.html b/reference/C/CONCEPT/true_false.html
new file mode 100644
index 0000000..db7f90e
--- /dev/null
+++ b/reference/C/CONCEPT/true_false.html
@@ -0,0 +1,78 @@
+<title>True or False</title>
+<body bgcolor="#ffffcc">
+<hr>
+<center>
+<h1>True or False.</h1>
+</center>
+<hr>
+The concept of an <a href="../CONCEPT/expressions.html">expression</a> evaluating to true or false is one of
+the corner stones of C. BUT the language derives true and false in an
+unusual way.<p>
+Basicly there is no boolean value. The number 0 is considered to be false
+and all other numbers are considered to be true....<p>
+
+Please consider the following expressions.
+
+<pre>
+ (1 == 1) true
+ (1 != 1) false
+ (i = 1) true
+ (i = 0) false
+ (i = 1 + 1) true
+</pre>
+The first two examples should be clear but the last ones need explanation .<p>
+The last three examples assign a value to a variable and a side effect of
+assignment is to return the value assigned, it is <b>this</b> value that is tested
+to be true or false.<p>
+Looking at the last example:
+<pre>
+ (i = 1 + 1)
+ (i = 2)
+ (2)
+</pre>
+
+<ul>
+<li>The third expression assigns a value of 1 to <b>i</b>. 1 is considered to
+be true because it is non-zero.
+<p>
+<li>The fourth expression assigns a value of 0 to <b>i</b>. 0 is considered to
+be false.
+<p>
+<li>The fith expression assigns a value of 2 to <b>i</b>. 2 is considered to
+be true, because it is non-zero.
+</ul>
+<p>
+<hr>
+<h2>See Also:</h2>
+<img src=../../GRAPHICS/whiteball.gif>
+<A HREF="../SYNTAX/enum.html">enum keyword</A>
+<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> Corrections made by Christopher Wolf
+<! cwolf@tools.micro.ti.com>
+
+