WWW-www.enlightenment.org pushed a commit to branch master.

http://git.enlightenment.org/website/www-content.git/commit/?id=b39fb9e43da7ac3a54d38863d77032d2c12dc977

commit b39fb9e43da7ac3a54d38863d77032d2c12dc977
Author: Raster <ras...@rasterman.com>
Date:   Thu May 28 00:02:04 2015 -0700

    Wiki page start changed with summary [] by Raster
---
 pages/docs/c/start.txt | 37 +++++++++++++++++++++++++++++++++++--
 1 file changed, 35 insertions(+), 2 deletions(-)

diff --git a/pages/docs/c/start.txt b/pages/docs/c/start.txt
index cfa9117..d846ffc 100644
--- a/pages/docs/c/start.txt
+++ b/pages/docs/c/start.txt
@@ -95,7 +95,7 @@ An example:
 
 CPUs will do arithmetic, logic operations, change what it is they execute, and 
read from or write to memory to deal with data. In the end, everything to a CPU 
is effectively a number, somewhere to store it to or load it from and some 
operation you do to it.
 
-To computers, numbers are a string of "bits". A bit can be on or off. Just 
like you may be used to numbers, with each digit having 10 values (0 through to 
9), A computer sees numbers more simply. It is 0, or it is 1. Just like you can 
have a bigger number by adding a digit (1 digit can encode 10 values, 2 digits 
can encode 100 values, 3 can encode 1000 values etc.), So too with the binary 
(0 or 1) numbering system computers use. Every binary digit you add doubles the 
number of values you [...]
+To computers, numbers are a string of "bits". A bit can be on or off. Just 
like you may be used to numbers, with each digit having 10 values (0 through to 
9), A computer sees numbers more simply. It is 0, or it is 1. Just like you can 
have a bigger number by adding a digit (1 digit can encode 10 values, 2 digits 
can encode 100 values, 3 can encode 1000 values etc.), So too with the binary 
(0 or 1) numbering system computers use. Every binary digit you add doubles the 
number of values you [...]
 
 ^Binary           ^Hexadecimal ^Decimal ^
 |101              |d           |14      |
@@ -150,7 +150,7 @@ You can even tell the compiler to make sure it has an 
initial value. If you don'
 int bob = 42;
 </code>
 
-Once you have declared a variable, you can now use it. You can group values 
together in repeating sequences using //arrays// or in mixed groups called 
//structs// that contain a sequence of variables structured as indicated. Order 
is important and is maintained in memory. You can at times take advantage of 
this ordering for doing things like "inheritance". Arrays also have strict 
ordering in memory, so you can later on use pointers and simple arithmetic to 
walk up and down an array to ac [...]
+Once you have declared a variable, you can now use it. You can group values 
together in repeating sequences using //arrays// or in mixed groups called 
//structs// that contain a sequence of variables structured as indicated. Order 
is important and is maintained in memory. You can at times take advantage of 
this ordering for doing things like "inheritance". Arrays also have strict 
ordering in memory, so you can later on use pointers and simple arithmetic to 
walk up and down an array to ac [...]
 
 <code c>
 int bobs[100];
@@ -433,6 +433,39 @@ So only compile the active code in when enabled in the 
compilation process.
 ----
 
 ==== Memory ====
+
+Reality is that languages like C are really a slightly more convenient and 
portable interface to the actual machine you have. That means the CPU, it's 
instructions and processing as well as memory that the CPU will access one way 
or another. Let's visualize just some of this. Imagine memory as simply a 
series of boxes than can contain a number that has a value from 0 to 255 (if 
unsigned). To do signed values we just interpret values differently. We can 
have from -128 to 127 as values. Wh [...]
+
+^Byte ^Value ^
+|0    |01    |
+|1    |2e    |
+|2    |fe    |
+|3    |00    |
+|4    |1a    |
+|5    |43    |
+|6    |aa    |
+|...  |...   |
+
+And so on. All memory is a massive set of these bytes, one after the other. On 
modern systems you don't have hundreds or even thousands of these boxes, but 
you have millions or even billions of them. You can group them together to 
store more than just a small value. This is what shorts, ints, longs and long 
longs do (as well as floats and doubles). They simply tell the CPU to take a 
set of 2, 4 or 8 bytes together to be a larger value.
+
+Let us see how a struct might map onto memory in this way. This struct:
+
+<code c>
+struct mydata
+{
+   int    number1;
+   char   string1[15];
+   int    number2;
+   double floating_point1;
+   char   char1;
+   float  floating_point2;
+   short  short1;
+   int    number3;
+   double floating_array[3];
+};
+</code>
+
+
 ==== Libraries ====
 ==== API calls ====
 ==== System calls ====

-- 


Reply via email to