diff options
author | Levi Bostian <levi.bostian@gmail.com> | 2013-08-31 16:24:56 -0500 |
---|---|---|
committer | Levi Bostian <levi.bostian@gmail.com> | 2013-08-31 16:33:55 -0500 |
commit | 5c711eb30fe8cd810627742a30c016f458bd773c (patch) | |
tree | 89dac87bc080eb4865a2ddf277045510bcb9d08f /c.html.markdown | |
parent | b0c5ca0a1cc5a62fc8569fffffcdf35bf44e8dc8 (diff) |
Add more shorthand notes, array notes to C
Diffstat (limited to 'c.html.markdown')
-rw-r--r-- | c.html.markdown | 6 |
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; |