Question: Using pointers write a function called removeChar that will remove each instance of a specified character from a CString. A CString is defined as an

Using pointers write a function called removeChar that will remove each instance of a specified character from a CString.

A CString is defined as an array of characters that is terminated by the NULL ('\0') character.

Your function should return the number of characters that were removed from the string.

Your function should take as arguments, the CString to remove the characters from, and the character to remove.

Note:

The argument which represents the character to be removed should be a default argument. Meaning that if a character is not provided it will default to the space character (Decimal 32 or Hex 20).

Using the subscript operator [] is not using a pointer.

What not to do

Using any of the following will drop your grade for this assignment by 70%

global variables.

cin in any funciton other than main

cout in any funciton other than main

goto statements

Note:

To get a sentence from the keyboard you must use cin.getline:

char str[100];

cin.getline(str, 99); // save room for the null character.

Your output should look something like the following:

Using pointers write a function called removeChar that will remove each instance

C:Windows system32\cmd.exe This is a test i hope it works Enter a character to remove Removed 4 i characters. Your string is now: Ths s a test hope t works Press any key to continue

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!