aboutsummaryrefslogtreecommitdiffstats
path: root/dev/c/datatypes.html
diff options
context:
space:
mode:
Diffstat (limited to 'dev/c/datatypes.html')
-rw-r--r--dev/c/datatypes.html178
1 files changed, 178 insertions, 0 deletions
diff --git a/dev/c/datatypes.html b/dev/c/datatypes.html
new file mode 100644
index 0000000..35b6ca4
--- /dev/null
+++ b/dev/c/datatypes.html
@@ -0,0 +1,178 @@
+<!DOCTYPE html>
+<html dir="ltr" lang="en">
+ <head>
+ <meta charset='utf-8'>
+ <title>Datatypes</title>
+ </head>
+ <body>
+ <a href="../index.html">Development Index</a>
+
+ <h1>Datatypes</h1>
+
+ <h2 id="types">Types</h2>
+
+ <dl>
+ <dt>char</dt>
+ <dd>Integer, one byte.</dd>
+ <dt>int</dt>
+ <dd>Integer.</dd>
+ <dt>float</dt>
+ <dd>Single precision floating point.</dd>
+ <dt>double</dt>
+ <dd>Double precision floating point.</dd>
+ <dt>void</dt>
+ <dd>Absence of type.</dd>
+ </dl>
+
+
+ <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>
+
+ <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>
+ <h2 id="st">Storage class</h2>
+
+ <h2 id="format">Format Type Specifiers</h2>
+
+ <dl>
+ <dt>%c</dt>
+ <dd>Character</dd>
+ <dt>%s</dt>
+ <dd>String of characters</dd>
+ <dt>%d</dt>
+ <dd>Decimal integer</dd>
+ <dt>%f</dt>
+ <dd>Decimal floating point</dd>
+ <dt>%llu</dt>
+ <dd>unsigned long long</dd>
+ <dt>%o</dt>
+ <dd>Signed octal</dd>
+ <dt>%u</dt>
+ <dd>Unsigned decimal integer</dd>
+ <dt>%x</dt>
+ <dd>Unsigned hexadecimal integer</dd>
+ <dt>%p</dt>
+ <dd>Pointer address</dd>
+ </dl>
+
+ <a href="../index.html">Development Index</a>
+ <p>This is part of the c9 Manual.
+ Copyright (C) 2018
+ c9 team.
+ See the file <a href="../../fdl-1.3-standalone.html">Gnu Free Documentation License</a>
+ for copying conditions.</p>
+
+ </body>
+</html>