Review Question s

The answers to the review questions are in Appendix B.

  1. Review Question s - 图1How

    would you declare a character array called my_name that holds the following string literal?

“ Thi s i s C++”

  1. How long is the string in Question 1?

  2. How many bytes of storage does the string in Question 1 take?

  3. Review Question s - 图2With

    what do all string literals end?

  4. How many variables do the following statements declare, and what are

    their types?

char name[ 25]; char addr ess[ 25];

  1. True or false: The following statement assigns a string literal to a

    character array.

myname[] =” Ki m Langst on” ;

EXAMPLE

  1. Review Question s - 图3True

    or false: The following declaration puts a string in the character array called ci t y .

char ci t y[] ={ ‘ M’ , ‘i’ , ‘ a’ , ‘ m’ , ‘i’ , ‘ \ 0’ } ;

  1. True or false: The following declaration puts a string in the

    character array called ci t y .

char ci t y[] ={ ‘ M’ , ‘i’ , ‘ a’ , ‘ m’ , ‘i’ } ;