#Meta-Wlp: #Macro: TITLE wlp: Learn C (III) p. 11 #Eval: $TITLE$ #Macro: PAGE bb3-11

Congratulations!

You have come very far in your knowledge of C.

Review

  1. Expressions evaluate to a value. Examples are: arithmetic expressions such as + and *; assignment expressions such as = and +=; and logical expressions such as == and &&.
  2. Assignment statements are assignment statements followed by a semicolon.
  3. Compound statements are series of statements enclosed in curly braces.
  4. The while statement repeatedly runs its following compound statement or single statement until its control expression is false.
  5. The if statement runs its following compound statement or statement if its control expression is true.
  6. Variables are declared before used. Two types of variables are int (integer) and char (character).
  7. Sequences of characters are located using a reference to character, char-star. A reference to character is also called a pointer.
  8. Strings can be referenced using char-star, but they always are terminated by a end-of-string marker.
  9. printf is in library stdio.h. Its first argument is a format string. Special characters, introduced by a %, control the substitution into the format string of the remaining arguments after the format string argument.
Exercises
  1. Write a program which prints out all the integers-cubed less than 100.
  2. Write a program that prints continues this pattern up to a line length of 72 characters:
       ab
       aabbab
       aaabbbaabbab
    

Learn C Introduction