CS12

Lab 2

In this lab you will be using pointers. You may not use any string functions and you may not use the subscript([]) operator. The subscript operator may only be used for obtaining space for an array.

Write a function that takes a character array and two characters as parameters. This function should go through the character array and replace all occurrences of the first charcater parameter with the second character parameter. While doing this, keep count of how many replacements are made and have your function return this count.

Write a program that prompts the user for a sentence.The sentence should then be stored into an array that does not waste space. Allow the user to replace a specific character with a second character throughout your sentence (use your function). Output the number of replacements made and the new string.