Question: C + + Ch 7 , 8 Pointers and Streams - Write a program in which you create four functions that work with C -
C Ch Pointers and Streams
Write a program in which you create four functions that work with Cstyle strings. These functions must use pointers in their implementation and must not use any C library code.
The functions to implement are:
length which determines how many characters are in the string; its parameter is a pointer to the Cstyle string;
its output value is a number representing the count of characters in the string which might be zeronote that the input string is not modified
indexof which determines the index location of a character; its parameters are a pointer to the Cstyle string and a character which is to be searched for; its output value is a number representing the first lowest index of the character or if the character is not found in the stringnote that the input string is not modified
replace which changes every occurrences of a character within the string with a different character; its parameters are a pointer to the Cstyle string, a character representing the character to replace, and another character representing the character that each found occurrence is changed to; the output value is a pointer to the input string which permits easier coding for the client codenote that the input string is modified
concat which produces a new Cstyle string being the concatenation of two input strings; its parameters are two pointers to strings; the output value is a pointer to a newly created string which is a copy of the first string followed by a copy of the secondnote that the input strings are not modified and that the client code should delete the new string before exiting the program
Write a program that tests each function and displays the results of their use.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
