Wite a function named append that accepts three arguments


Question: Write a function named append that accepts three arguments. The first two arguments passed to append are c-strings to be appended (the second c-string is appended to the first). The third argument passed should be the size of the character array passed as the first argument.

Before appending, append should verify there is enough space in the character array to accept the appended string. If there is, then the append operation should proceed and append should return the total size of the appended string. If the appended string is too large to fit inside the character array, then append should return -1 without appending.

Demonstrate the function in a program.

Note: You may find the c-string functions strlen() and strcat() useful.

In other words, write a function that verifies there is sufficient space to append a c-string to an existing c-string. If there is, append and return the size of the appended string. If not, return -1.

Use the c programming language to prepare this program. 

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Wite a function named append that accepts three arguments
Reference No:- TGS0947769

Expected delivery within 24 Hours