Question: char * removeExtraRs ( char * str ) This function returns a dynamically allocated new string which removes all but the last three r '
char removeExtraRschar str
This function returns a dynamically allocated new string which removes all but the last three rs from the given string both lower and upper case rs Some simple examples:
removeExtraRsRrRrRrRr should return the string rRr
remoneExtraRsRarerstrawberries" should return the string acstrawberries"
removeExtraRsNothingtodo should return the string "Nothingtodo
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 ie don't malloc more memory than you need Remember that 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 points Complete the following helper function which finds the number of rs both upper and lower case in the given string:Find the number of rs both upper and lower case in strHint: use a loop, You can call strlen to find the length of str
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
