Review Question s
The answers to the review questions are in Appendix B.
- How
would you declare a character array called my_name that holds the following string literal?
“ Thi s i s C++”
-
How long is the string in Question 1?
-
How many bytes of storage does the string in Question 1 take?
-
With
what do all string literals end?
-
How many variables do the following statements declare, and what are
their types?
char name[ 25]; char addr ess[ 25];
- True or false: The following statement assigns a string literal to a
character array.
myname[] =” Ki m Langst on” ;
EXAMPLE
- 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’ , ‘ \ 0’ } ;
- 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’ } ;