Question: This is a C program. The screenshots are the green boxes. Please use the guidelines on the red box and try to get a sample

This is a C program. The screenshots are the green boxes. Please use the guidelines on the red box and try to get a sample output like the one in the picture.

Exercise 1 (50 points): Write your own versions of the strlen and strncat functions described in the text. (See the screenshot of the function descriptions given below. figure 8.14 and 8.33) Write a function named removechr that removes all occurrences of the specified character from a string. All three of these functions will use pointers and pointer arithmetic. (You may not use array subscripts anywhere in your functions.)

Your removechr function will be prototyped as follows:

char *removechr(char *string, const char ch);

The function removechr removes all occurrences of a character from a string and returns a pointer to the modified string. Please note it does modify the string that is its first argument and it is case sensitive. (T is treated differently than t.)

This is a C program. The screenshots are the green boxes. Please

Sample output of a driver used to test removechr produced the following results:

use the guidelines on the red box and try to get a

You may NOT call anything from the library in your functions.

You may test your strlen and strncat functions by comparing the results produced with those produced by the library versions. You will need to create a driver to test your functions.

We will be testing your functions with our driver. We will NOT be including the string.h header file in our program. Again your functions must work without using anything from the library! The required files are 3 codes one each with strlen, strncat and removechar.

GUIDELINES

sample output like the one in the picture. Exercise 1 (50 points):

Fig. 8.14 String-manipulation functions of the string-handling library Function Function description prototype char stropy char s1, const char s2) Copies string s2 into array s1. The value of s1 is returned char strncpy (char 1, const char s2, size_t n) Copies at most n characters of string s2 into array s1 and returns s1 char strcat (char s1, const char s2) Appends string s2 to array s1. The first character of s2 overwrites the terminating null character of s1. The value of s1 is returned. char strncat(char 1, const char s2, size t n) Appends at most n characters of string s2 to array 1. The first character of s2 overwrites the terminating null character of s1. of s1 is returned. The value Fig. 8.33 Other functions of the string-handling library. Function Function description prototype char "strerror (int errornum) Maps errornum into a full text string in a compiler- and locale-specific manner (e.g. the message may appear in different spoken languages based on the computer's locale). A pointer to the string is returned. Error numbers are defined in errno.h size t strlen(const char): Determines the length of string s. The number of characters preceding the terminating null character is returned

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!