Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this program, you will write your own versions of two string library functions. Those functions are: char * mystrcat ( char * dest, char

In this program, you will write your own versions of two string library functions.
Those functions are:
char* mystrcat(char* dest, char* src): Concatenates string in character array src to string in array dest. Returns dest when complete.
Recall that string concatenation adds one string to the end of another, thus creating a longer string. So, if char s1[50]= "EECE" and char s2[50]=".2160" calling mystrcat(s1, s2) would change the contents of s1 to "EECE.2160".
char* myfgets(char* str, int n, FILE* fp): Read line of input (up to n -1 characters) into str from input source fp, which can refer to an input file or stdin. Returns str when done.
This function should read characters from its input source and store them in the array str until either (1) a newline (
) is read and stored, or (2) the maximum number of characters is reached.
So, for example, given char s[20] and user input "This is a string." with a newline after the period:
Calling myfgets(s,20, stdin) would set s = "This is a string.
"(the newline character wouldn't appear in this way, but it would be in the array)
Calling myfgets(s,5, stdin) would set s = "This"
Make sure both functions ensure the resulting string is null-terminated when it's done!
In the file below, you should leave the main function unchanged. The function definitions you need to write are listed at the top of the file.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Objects And Databases International Symposium Sophia Antipolis France June 13 2000 Revised Papers Lncs 1944

Authors: Klaus R. Dittrich ,Giovanna Guerrini ,Isabella Merlo ,Marta Oliva ,M. Elena Rodriguez

2001st Edition

3540416641, 978-3540416647

More Books

Students also viewed these Databases questions