Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C functions, follow description please! if string has multiple words, spaces between those words must be preserved 1. int remove spaces(const char source, char result,
C functions, follow description please!
if string has multiple words, spaces between those words must be preserved
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 OF SUCCESS (defined in file tatmanipulation.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 nequals (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_jmanipulation.ht). a. FAILURE - if source is NULL or source length is 0 or width is less than source length b. SUCCESS - otherwise, ie, the result centers the source string. Assume that parameter source is NULL or points to a null-terminated string. Assume that out parameter result points to a char array long enough to hold the result string Assume that the source string does not contain only blank characters. If the source string has multiple words, the spaces between those words must be preserved
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started