Question: Write a function named replaceBlanks that accepts a pointer to a C-string (an array of characters with a NULL terminating character) and it

Write a function named "replaceBlanks" that accepts a pointer to a C-string (an array of characters with a NULL terminating character) and it will replace all blanks in that C-string array with question mark ('?'). It will return three values: - the number of blanks that it has replaced with '?' - the number of '?' that was already in the C-string - the boolean flag that is true if after replacement, the C-string is all '?' and false otherwise.

For example, here are examples of C-string and its expected return values "One Two Three" will become "One?Two?Three" and it will return 2 blanks, 0 question mark and false "? ? " will become "????" and it will return 2 blanks, 2 question marks and true " " will become "?" and it will return 1 blank, 0 question mark and true "?" will become "?" and it will return 0 blank, 1 question mark and true "1" will become "1" and it will return 0 blank, 0 question mark and false "" will become "" and it will return 0 blank, 0 question mark and false "1?" will become "1?" and it will return 0 blank, 1 question mark and false "1 " will become "1?" and it will return 1 blank, 0 question mark and false

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!