Sams Teach Yourself C in 21 Days

(singke) #1
d. The function definition for display_line()is on lines 16 through 22.
e. Comments are on lines 1, 15, and 23.


  1. A comment is any text included between /and/. Examples include the follow-
    ing:
    / This is a comment /
    /???/
    /
    This is a
    third comment
    /
    You can also use single-line comments which is any text after to forward slashes.

  2. This program prints the alphabet in all capital letters. You should understand this
    program better after you finish Day 10, “Characters and Strings.”
    The output is
    ABCDEFGHIJKLMNOPQRSTUVWXYZ

  3. This program counts and prints the number of characters and spaces you enter.
    This program also will be clearer after you finish Day 10.


Answers for Day 3

Quiz


  1. An integer variable can hold a whole number (a number without a fractional part),
    and a floating-point variable can hold a real number (a number with a fractional
    part).

  2. A type doublevariable has a greater range than type float(it can hold larger and
    smaller values). A type doublevariable also is more precise than type float.

  3. a. The size of a charis one byte.
    b. The size of a shortis less than or equal to the size of an int.
    c. The size of an intis less than or equal to the size of a long.
    d. The size of an unsignedis equal to the size of an int.
    e. The size of a floatis less than or equal to the size of a double.

  4. The names of symbolic constants make your source code easier to read. They also
    make it much easier to change the constant’s value.

  5. a.#define MAXIMUM 100
    b.const int MAXIMUM = 100;

  6. Letters, numerals, and underscores.


832 Appendix F

49 448201x-APP F 8/13/02 11:22 AM Page 832

Free download pdf