Problem Set: C Strings


    1. Create a string that can hold up to 30 characters.
    2. Prompt the user and read a line into the string.
    3. Print the string.
    4. Print the first letter.
    5. Print the length of the string. DO NOT USE STRLEN.
    6. Add '!' to the end of the string.
    7. Print the string with each character on a separate line. (Use %c in printf to print a character.
    8. Print the string again.
  1. Prompt and read two words and print the words in alphabetical order.
  2. Prompt and read three words and print the words in alphabetical order.
  3. Write a function with one parm, a string. The function should return the number of words in the string. You can assume there is only one blank between words.
  4. Write the statements to prompt and read a line, call your function from the previous problem, and print the number of words in the line.
  5. Write a function to count and return the number of vowels in the string parameter.
  6. Write a loop which will prompt and read a line, call your function from the previous problem, and print the number of vowels. Stop your loop when the user enters "end".
  7. Write and test your own version of strlen.
  8. Write and test your own version of strcpy.
  9. Write and test your own version of strcat.


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

    © Copyright Emmi Schatz 2020