Question: Hi i need help with this questions in C Coding language. The code file bc #include #include #include #include char* repeated (char* original, int n);

Hi i need help with this questions in C Coding language.

Hi i need help with this questions in C Coding language. The

The code file bc

#include #include #include #include char* repeated (char* original, int n); int main(void) { Printf(%s , repeated(bon, 2)); Printf(%s , repeated(bon, 3)); Printf(%s , repeated(bon, 4)); Return 0; } char* repeated (char* original, int n) { Int i, length = strlen(original); char* newString = malloc (sizeof(char)) * length * n + 1); char* helper (sizeof(char)) * length * n + 1); char* helper = newString; For (i = 0; i Take your fixed version of labo2b.c, copy it, and rename it lab03strings.c. Then add the following functions to this code: 1. rightStrip - this function takes a string as an argument and a character and then it modifies the string (it does not return) so that the character or characters at the end of the passed string that match the character parameter are removed. For example, if "hihiii" and I are parameters, then the updated string in the calling block should contain: "hih". If "hihi" and "i" are parameters, then the updated string in the calling block should contain: "hih". If "hi" and "h" are parameters, then no modification takes place. Remember that you control what's considered string contents with the null character. Test this function by calling it from main. 2. center - this function takes three parameters: string, character, and integer. It returns a new, dynamically allocated string that is a copy of the original string centered within the specified width and padded on the left and right with an extra character. For example, if "hello" 7', and 15 were passed, the function should return ?????hello????? if "hello", ?', and 16 were passed, then it doesn't matter if you append the 6th ? at the front or back of the string. Assume that the caller of your function will always pass valid values, i.e. there is no need to handle widths shorter than the length of the string for example. Test this function by calling it from main. 3. Once the program runs properly, check your code and tests for memory leaks and memory errors with Valgrind and apply more fixes, as needed to get a clean report

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 Databases Questions!