Write function concept that takes two source arrays of chara

Write function concept that takes two source arrays of characters and a destination array of characters. The function should concatenate two source arrays and store in the destination array.

Solution

he C library function strcat() can be used to concatenate C strings. This function takes two arguments: 1) a pointer to a destination character array that contains a valid C string, and 2) a pointer to a valid C string or string literal. The function returns a pointer to the destination array, although this return value is frequently ignored.

The destination array must be large enough to hold the combined strings (including the null character). If it is not, the array will overflow.

Passing and returning

Regardless of how a C string is declared, when you pass the string to a function or return it from a function, the data type of the string can be specified as either char[] (array of char) or char* (pointer to char). In both cases, the string is passed or returned by address.

A string literal like \"hello\" is considered a constant C string, and typically has its data type specified as const char* (pointer to a char constant).

 Write function concept that takes two source arrays of characters and a destination array of characters. The function should concatenate two source arrays and

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site