Question: Define a function with the following declaration: unsigned int replaceName(cat* a_cats, unsigned int numCats, const char* origName, const char* newName) replaceName finds each occurrence of
Define a function with the following declaration: unsigned int replaceName(cat* a_cats, unsigned int numCats, const char* origName, const char* newName) replaceName finds each occurrence of a c-string name (origName) in the list of cats (array a_cats which has numCats elements) and replaces that name with c-string newName. The function returns the number of names that were changed. For example, let's pretend we have an array of 24 cat structs in array myCats. Three cats have unfortunately been named "Mullet". Let's change that name to "Mittens". unsigned int numChanged = replaceName(myCats, 24, "Mullet", "Mittens"); numChanged should be equal to 3 after the above line. No cat should be named Mullet in myCats afterwards....or in general. That's abusive to cats.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
