aboutsummaryrefslogtreecommitdiffstats
path: root/dev
diff options
context:
space:
mode:
Diffstat (limited to 'dev')
-rw-r--r--dev/c/datatypes.html107
-rw-r--r--dev/index.html2
2 files changed, 107 insertions, 2 deletions
diff --git a/dev/c/datatypes.html b/dev/c/datatypes.html
index 6d6b76d..a149c24 100644
--- a/dev/c/datatypes.html
+++ b/dev/c/datatypes.html
@@ -12,12 +12,117 @@
<h2 id="datatypes">Data types</h2>
<h2 id="int">Integer</h2>
+ <p>Allowed <a href="elements.html#types">types</a> are char and int;</p>
+ <dl>
+ <dt>signed char</dt>
+ <dd>8 bit, from -128 to 127.</dd>
+ <dt>unsigned char</dt>
+ <dd>8 bit, from 0 to 255.</dd>
+ <dt>char</dt>
+ <dd>8 bit, used to store ASCII, ex; 'h', '\n', etc...</dd>
+ <dt>short int</dt>
+ <dd>16 bit, from -32,768 to 32,767.</dd>
+ <dt>unsigned short int</dt>
+ <dd>16 bit, from 0 to 65,535.</dd>
+ <dt>int</dt>
+ <dd>32 bit, from -2,147,483,648 to 2,147,483,647.</dd>
+ <dt>unsigned int</dt>
+ <dd>32 bit, from 0 to 4,294,967,295.</dd>
+ <dt>long int</dt>
+ <dd>32 bit, from -2,147,483,648 to 2,147,483,647.</dd>
+ <dt>unsigned long int</dt>
+ <dd>32 bit, from 0 to 4,294,967,295.</dd>
+ <dt>long long int</dt>
+ <dd>64 bit, from 9,223,372,036,854,775,808
+ to 9,223,372,036,854,775,807.</dd>
+ <dt>unsigned long long int</dt>
+ <dd>64 bit, from 0 to 18,446,744,073,709,551,615.</dd>
+ </dl>
+
<h2 id="double">Real number</h2>
+
+ <p>Real numbers are fractional numbers, all floating points
+ are signed. Check float.h.</p>
+
+ <dl>
+ <dt>float</dt>
+ <dd>From 1e-37 to 1e37</dd>
+ <dt>double</dt>
+ <dd>Largest of floating point.</dd>
+ <dt>long double</dt>
+ <dd>The long double data maybe larger than double</dd>
+ </dl>
+
<h2 id="complex">Complex number</h2>
- <h2 id="const">Enumeration</h2>
+
+ <p><a href="https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.html#Standard-Complex-Number-Types">Complex Number Types</a></p>
+
+ <h2 id="enum">Enumeration</h2>
+
+ <pre>
+ enum colors {black, orange, blue} color;
+ enum colors color;
+ </pre>
+
<h2 id="union">Unions</h2>
+
+ <pre>
+ union accounts {
+ int id;
+ float value;
+ } first_account, second_account;
+ </pre>
+
<h2 id="struct">Structures</h2>
+
+ <pre>
+ struct point {
+ int x, y;
+ } first_point;
+ struct point second_point;
+ </pre>
+
<h2 id="array">Arrays</h2>
+
+ <pre>
+ int account_array[9];
+ int account_array[] = {0, 1, 2, 3};
+ int account_array[] = {0, 1, 2, [9] = 9};
+ </pre>
+
+ <pre>
+ int account_array[2][9] { {1,2,3},{9,8,7} }
+ </pre>
+
+ <p>Initializing string with individual characters the
+ null character must be defined;</p>
+
+ <pre>
+ char black[] = {'b', 'l', 'a', 'c', 'k', '\0'}
+ </pre>
+
+ <pre>
+ char black[] = "black";
+ </pre>
+
+ <pre>
+ union accounts {
+ int id;
+ float value;
+ };
+ union accounts accounts_array[9];
+ accounts_array[0].id = 8;
+ </pre>
+
+ <pre>
+ struct point {
+ int x, y;
+ };
+ struct point point_array[9];
+ point_array[0].x=2;
+ point_array[0].y=3;
+ </pre>
+
<h2 id="pointer">Pointers</h2>
<h2 id="it">Incomplete types</h2>
<h2 id="tq">Type qualifiers</h2>
diff --git a/dev/index.html b/dev/index.html
index d84fa36..afd147e 100644
--- a/dev/index.html
+++ b/dev/index.html
@@ -62,7 +62,7 @@
<li><a href="c/datatypes.html#int">Integer</a></li>
<li><a href="c/datatypes.html#double">Real number</a></li>
<li><a href="c/datatypes.html#complex">Complex number</a></li>
- <li><a href="c/datatypes.html#const">Enumeration</a></li>
+ <li><a href="c/datatypes.html#enum">Enumeration</a></li>
<li><a href="c/datatypes.html#union">Unions</a></li>
<li><a href="c/datatypes.html#struct">Structures</a></li>
<li><a href="c/datatypes.html#array">Arrays</a></li>