diff options
Diffstat (limited to 'c.html.markdown')
-rw-r--r-- | c.html.markdown | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/c.html.markdown b/c.html.markdown index 7c9dd590..babf0954 100644 --- a/c.html.markdown +++ b/c.html.markdown @@ -143,9 +143,9 @@ int main (int argc, char** argv) // can be declared as well. The size of such an array need not be a compile // time constant: printf("Enter the array size: "); // ask the user for an array size - int size; - fscanf(stdin, "%d", &size); - int var_length_array[size]; // declare the VLA + int array_size; + fscanf(stdin, "%d", &array_size); + int var_length_array[array_size]; // declare the VLA printf("sizeof array = %zu\n", sizeof var_length_array); // Example: @@ -238,7 +238,7 @@ int main (int argc, char** argv) // Increment and decrement operators: char *s = "ILoveC"; int j = 0; - s[j++]; // => "i". Returns the j-th item of s THEN increments value of j. + s[j++]; // => "I". Returns the j-th item of s THEN increments value of j. j = 0; s[++j]; // => "L". Increments value of j THEN returns j-th value of s. // same with j-- and --j @@ -779,4 +779,4 @@ Readable code is better than clever code and fast code. For a good, sane coding Other than that, Google is your friend. -[1] http://stackoverflow.com/questions/119123/why-isnt-sizeof-for-a-struct-equal-to-the-sum-of-sizeof-of-each-member
\ No newline at end of file +[1] http://stackoverflow.com/questions/119123/why-isnt-sizeof-for-a-struct-equal-to-the-sum-of-sizeof-of-each-member |