Write a function named append that accepts three arguments

Assignment Help C/C++ Programming
Reference no: EM13694477

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. 

Reference no: EM13694477

Questions Cloud

Determine the security risks with respect to phishing : Mobile banking features have added several advantages for customers. Determine the security risks with respect to phishing, smishing, vishing, cloning, and a lost or stolen Smartphone that have been experienced by the financial services industry ..
Solve a single quadratic equation of the form : Write a C++ program to solve a single quadratic equation of the form - The actual solution of the equation shall be done by a function named equSolver(), which takes three coefficients as parameters and returns a structure of three fields: two root..
Use of universal quantification : Let L1, L2, ..., Ln be distinct lines in the Euclidean plane, and let A be the set of points formed by intersections of these lines. Characterize A using set notation and quantifiers.
Calculate the area and circumference of a circle : Write a program to move and calculate the area and circumference of a circle. - Calculate function, which passes the radius by value, and get back the area (PI*radius*radius) and circumference (2*PI*radius) of the circle through reference
Write a function named append that accepts three arguments : 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 ..
Program that computes the monthly loan payment : Write a program that computes the monthly loan payment, given the loan amount (a double value), the interest, as a percent % (a double value), and the number of years to repay the loan
Draw a diagram of how the stacks might look : Two stacks of positive integers are needed, both containing integers with values less than or equal to 1000. One stack contains even integers; the other contains odd integers.
Determine the successor to the throne of france : Define the predicate Successor(Year) giving the solution as the first successor to the crown for the year specified.
Write an expression whose value is a string : Assume that word is a variable of type string that has been assigned a value. Write an expression whose value is a string consisting of the last three characters of the value word. So if if the value if word were "biggest" the expression's value w..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a program to open a file for reading

Write a program to open a file for reading that has twenty (20) rows and in each row there are three (3) columns.

  Implement the guess the word

Implement  the ‘Guess the Word' game in an object-oriented manner

  Calculation of mortgage interest rates

Instruction of pointers and the calculation of mortgage interest rates.

  How many generations do you want to wait

How many generations do you want to wait? How many jackalopes do you have?

  Write and test a function to calculate the sum of the series

stop accumulating the sum when the term to add or subtract becomes smaller than a given small number(precision) oassed as an argument.

  Assume that you are tasked with tracking the orders which

loops and nested loops please respond to the followingbullsuggest one 1 example of a problematic programming situation

  Computer programming techniques

Construct a program from a design and use appropriate functions

  Data from the file grocery.dat

Read the data from the file Grocery.dat and assign values to the 10  GroceryItem  objects. Next display these items to allow a customer to select grocery items from the list and indicate the quantity of that item he or she would like to order. When t..

  Exponent and significant of a floating point

Write a program that requires the number of bits for the exponent and significant of a Floating Point representation; then requires two decimal real numbers and an operation either sum, subtraction or multiplication.

  The second argument to the function is the string

The function fnUserBinaryInputX has 2 input arguments, each is a string. The first string is the "prompt" string displayed to the user when asked to enter a string. The second argument to the function is the string to compare the user entered stri..

  In psuedocode, design an application

In psuedocode, design an application that has an array of at least 20 integers. It should call a module that uses the sequential search algorithm to locate one of the values

  Write a function that computes length of a character string

Write a function that computes the length of a character string (i.e. write your own implementation of the strlen function.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd