summaryrefslogtreecommitdiffhomepage
path: root/c.html.markdown
diff options
context:
space:
mode:
authorLevi Bostian <levi.bostian@gmail.com>2013-08-31 16:24:56 -0500
committerLevi Bostian <levi.bostian@gmail.com>2013-08-31 16:33:55 -0500
commit5c711eb30fe8cd810627742a30c016f458bd773c (patch)
tree89dac87bc080eb4865a2ddf277045510bcb9d08f /c.html.markdown
parentb0c5ca0a1cc5a62fc8569fffffcdf35bf44e8dc8 (diff)
Add more shorthand notes, array notes to C
Diffstat (limited to 'c.html.markdown')
-rw-r--r--c.html.markdown6
1 files changed, 5 insertions, 1 deletions
diff --git a/c.html.markdown b/c.html.markdown
index 166c43e6..c6fee5d7 100644
--- a/c.html.markdown
+++ b/c.html.markdown
@@ -166,6 +166,10 @@ int main() {
int i1 = 1, i2 = 2; // Shorthand for multiple declaration
float f1 = 1.0, f2 = 2.0;
+ //more shorthands:
+ int a, b, c;
+ a = b = c = 0;
+
// Arithmetic is straightforward
i1 + i2; // => 3
i2 - i1; // => 1
@@ -339,7 +343,7 @@ int main() {
printf("%d\n", x); // => Prints 1
// Arrays are a good way to allocate a contiguous block of memory
- int x_array[20];
+ int x_array[20]; //declares array of size 20 (cannot change size)
int xx;
for (xx = 0; xx < 20; xx++) {
x_array[xx] = 20 - xx;