diff options
author | Adam <adam@adambard.com> | 2016-10-21 15:35:09 -0700 |
---|---|---|
committer | Adam <adam@adambard.com> | 2016-10-21 15:35:09 -0700 |
commit | 620e5d20402be961d27ce6cc6a007204c81391d4 (patch) | |
tree | e33427b1aa82c11a8e974ccd8a02b789de4c9737 /c.html.markdown | |
parent | de376b4357e79fc847e4c1ae2717946fe05d3bef (diff) | |
parent | 0659107a78bddd722df816daa01ee622fb4508d1 (diff) |
Merge branch 'master' of github.com:adambard/learnxinyminutes-docs
Diffstat (limited to 'c.html.markdown')
-rw-r--r-- | c.html.markdown | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/c.html.markdown b/c.html.markdown index 92f07fe2..ae87ca08 100644 --- a/c.html.markdown +++ b/c.html.markdown @@ -236,11 +236,9 @@ int main (int argc, char** argv) z = (e > f) ? e : f; // => 10 "if e > f return e, else return f." // 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. - j = 0; - s[++j]; // => "L". Increments value of j THEN returns j-th value of s. + int s = j++; // Return j THEN increase j. (s = 0, j = 1) + s = ++j; // Increase j THEN return j. (s = 2, j = 2) // same with j-- and --j // Bitwise operators! @@ -513,6 +511,7 @@ void str_reverse(char *str_in) str_in[len - ii - 1] = tmp; } } +//NOTE: string.h header file needs to be included to use strlen() /* char c[] = "This is a test."; |