Question: C functions 1. int remove_spaces(const char *source, char * result, int *num_spaces_removed); This function places in the result char array a copy of the source

C functions

C functions 1. int remove_spaces(const char *source, char * result, int *num_spaces_removed);

1. int remove_spaces(const char *source, char * result, int *num_spaces_removed); This function places in the result char array a copy of the source string with all leading and trailing spaces removed. If out parameter num_spaces_removed is not NULL, the function sets its associated integer to the number of spaces removed. The function returns one of two values: FAILURE or SUCCESS (defined in file text manipulation.h). a. FAILURE - if the source string is NULL or its length is 0. In this case the result char array is not changed (it keeps its original value). b. SUCCESS - if spaces are removed or no spaces are present. 2. int center(const char *source, int width, char* result); This function places in the result char array a copy of the source string that is centered as specified by the width parameter. Center the string by adding (to the left and right of the original string) n spaces where n equals (width-source string length)/2. Notice that the resulting centered string will have a length that is less than width when (width source string length) is odd. For example, if we were to center "dogs" with width of 7, the resulting string would be " dogs" (1 space to the left, 1 space to the right). The function returns one of two values: SUCCESS or FAILURE (see file text manipulation.h). a. FAILURE - if source is NULL or source length is 0 or width is less than source length. b. SUCCESS - otherwise, i.e., the result centers the source string

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!