STRING FUNCTIONS - WORKSHEET 1

Consider the following declarations.

char	name[25];
char	street[25];
char	city[15];
char	state[?];
char	fullname[?];
char	address[?];
  1. What size does the array, state[], need to be in ordered to hold the standard 2 letter abbreviation?

  2. What size does the array, address[], need to be in order to hold the data from city[] and state[] with a comma and one space in between?

  3. Assume the name[] array is formatted as, lastname, comma, space, firstname. (like Ross, Betsy) What size does fullname[] need to be in order to fit the data from name[], reformatted as first name, space, last name?

  4. Write code to rearrange the data from name[] into fullname[] so that it reads first name, space, last name.

  5. Write code to find the size of the string in city[].

  6. Move data from city[] and state[] to address[] so there is a comma and one space in between.

  7. Assume the street[] array has an address like 1175 N. Main Street. Move the numeric part of the address (1175) to a variable called streetnum. Assume there will be a maximum of 5 digits. Declare the variable.