Question: Write a C function with the following prototype: int resize (char s[], int array_size, int new_size); You function should change the size of the C-string
Write a C function with the following prototype:
int resize (char s[], int array_size, int new_size);
You function should change the size of the C-string stored in the array s. If new_size is shorter than the current length of the string, truncate the string. If new_size is longer than the current length of the string, pad the end of the string with spaces, but don't exceed the size of the array, which is stored in array_size. Return the new size of the string as the value of the function. Please be thorough with comments.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
