CS010 Practice 3

C String Manipulation

 
  1. Do Exercise 14 from Chapter 13 of King. Call the file small_large.c
  2. Write a program that prompts the user for two strings: a string to search through and a string to search for. The program should report if the 2nd string occurs within the first string or not. Sample output might be the following:
    Enter the string to search through: catnip
    Enter the string to search for:  cat
    cat was found in catnip!
       
    Enter the string to search through: catnip
    Enter the string to search for:  mouse
    mouse was not found in catnip!
       
    Enter the string to search through: catnip
    Enter the string to search for:  nip
    nip was found in catnip!

    Note that the values following the : characters are input by the user. You should allow blanks in the strings. Place this program in a file called match.c.

  3. Use the man pages to find a string function that makes the previous exercise much simpler. Rewrite the previous program using that function. Call this simple_match.c