C Program Control (Chapter 4) for-loops (4.4, 4.5, 4.6) This: alpha while( beta ) { /* do something */ gamma } Is equal to: for(alpha;beta;gamma) { /* do something */ } Counting up and down. Counting by multiples. Multiple expressions with comma. do-while (4.8) do { /* do something */ while( expr ); Don't forget the comma at the end! switch (4.7) Example of switching on a character grade. break; sends control to the end of the switch. Can use multiple cases to "fall through". Can use a default: case to catch the rest. break and continue (4.9) break; always sends control to the end of the block. continue; executes the "gamma" then restarts the loop with the "beta" expression. More About Types (This topic is scattered throughout the book, so here I am pulling together information from several places. Type Code Bytes Bits Range char %c 1 8 -128 to 127 short (int) %hd 2 16 -32768 to 32767 int %d 4 32 -2147483648 to 2147483647 long (int) %ld 8 64 -9223372036854775808 to 9223372036854775807 float %f 4 32 +/- 10^-45 to 10^38 (approx) double %lf 8 64 +/- 10^-300 to 10^300 (approx) unsigned options double the positive range. Now, more precise definitions of: Value Variable Operator Expression Each of these has a *type* (known at compile time) and a *value* (computed at runtime. The *type* is there to help the compiler find mistakes for you. An operator (+-*/) must have the same types on both side. If it does not, the smaller type is *promoted* to the larger type, then the operator returns a value of the larger type. Examples of expressions and type promotion. Special case: Characters are just integers in ASCII encoding, try this: char c; for(c=0;c<255;c++) { printf("%c\t%d\n",c,(int)c); }