Question: char * removeExtraRs ( char * str ) This function returns a dynamically allocated new string which removes all but the last three r '

char* removeExtraRs(char *str)
This function returns a dynamically allocated new string which removes all but the last three r's from the given string (both lower and upper case r's). Some simple examples:
removeExtraRs("RrRrRrRr") should return the string "rRr"
remoneExtraRs("Rarer-strawberries") should return the string "ac-strawberries"
removeExtraRs("Nothing_to_do") should return the string "Nothing_to_do"
Some additional requirements for your remove Extrals function:
The new string should have exactly enough size to store the chars in a string and a null terminator (i.e., don't malloc more memory than you need). Remember that '10' is the null terminator character which ends a string.
The only functions your removeExtraRs implementation should call are countRs, malloc, sizeof, strlen, and max (this finds the larger of two numbers).
(a)(2 points) Complete the following helper function which finds the number of r's (both upper and lower case) in the given string://Find the number of r's (both upper and lower case) in str//Hint: use a loop, You can call strlen to find the length of str,
char * removeExtraRs ( char * str ) This function

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!