summaryrefslogtreecommitdiffhomepage
path: root/c.html.markdown
diff options
context:
space:
mode:
authorLevi Bostian <levi.bostian@gmail.com>2013-09-01 10:59:30 -0500
committerLevi Bostian <levi.bostian@gmail.com>2013-09-01 10:59:30 -0500
commit977d226d26c056094a33f38da79d1d9395915f52 (patch)
tree40fe6208bb7247f813bf43e30e33336541500b38 /c.html.markdown
parent642e7c551e0f6292be403ed893a6695130cf350a (diff)
Reworded incrementing operators in C.
Diffstat (limited to 'c.html.markdown')
-rw-r--r--c.html.markdown6
1 files changed, 2 insertions, 4 deletions
diff --git a/c.html.markdown b/c.html.markdown
index f63adc05..c5ac7708 100644
--- a/c.html.markdown
+++ b/c.html.markdown
@@ -261,8 +261,7 @@ int main() {
// While loops exist
int ii = 0;
while (ii < 10) { //ANY value not zero is true.
- printf("%d, ", ii++); // ii++ increments ii in-place
- // after yielding its value ("postincrement").
+ printf("%d, ", ii++); // ii++ increments ii AFTER using it's current value.
} // => prints "0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "
printf("\n");
@@ -270,8 +269,7 @@ int main() {
int kk = 0;
do {
printf("%d, ", kk);
- } while (++kk < 10); // ++kk increments kk in-place, and yields
- // the already incremented value ("preincrement")
+ } while (++kk < 10); // ++kk increments kk BEFORE using it's current value.
// => prints "0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "
printf("\n");