Sams Teach Yourself C in 21 Days

(singke) #1

  1. A string is a sequence of characters terminated by the null character.

  2. A sequence of one or more characters enclosed in double quotation marks.

  3. To hold the string’s terminating null character.

  4. As a sequence of ASCII values corresponding to the quoted characters, followed
    by 0 (the ASCII code for the null character).

  5. a. 97
    b. 65
    c. 57
    d. 32
    e. 206
    f. 6

  6. a. I
    b. a space
    c. c
    d. a
    e. n
    f. NUL
    g.B

  7. a. 9 bytes. (Actually, the variable is a pointer to a string, and the string requires
    9 bytes of memory—8 for the string and 1 for the null terminator.)
    b. 9 bytes
    c. 1 byte
    d. 20 bytes
    e. 20 bytes

  8. a. A
    b. A string!
    c. 0 (NULL)
    d. This is beyond the end of the string, so it could have any value.
    e.!
    f. This contains the address of the first element of the string.


854 Appendix F

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

Free download pdf