C-Style String Worksheet


  1. Declare a string variable named phrase that can hold up to 80 characters.

  2. Declare a string variable named again that can hold up to 30 characters. Initialize again so that it contains your name.

  3. Prompt the user to enter their favorite phrase and read the response into the string phrase. Make sure you can read a phrase that contains more than one word

  4. Print out the phrase that the user entered in the previous problem.

  5. Write a function with one parameter - a C-style string. The function will print out the contents of the string, one character at a time. If the string is empty, your function should not print anything.

  6. Does your function need to know the size of the array that contains the string?

  7. Write a program that reads a string from the keyboard and prints out the string one word per line. Make your string large enough to hold 80 characters.

  8. Write a function that takes two string parms. The function should make the second string contain the reverse of the first string. For example, if the first second string contains "yes i can", then the function should set the first string to contain "nac i sey".



Email Me | Office Hours | My Home Page | Department Home | MCC Home Page

© Copyright Emmi Schatz 2002