Ask Question
7 September, 13:55

Concatenating arrays Strings have build-in functions to perform concatenation. Write a function called append () that performs concatenation for two char arrays (you will have to pass in a third char array that will hold the result). You will also need to pass in the lengths of each char array. You may not use strings for this part. Sample main code: char first[ ] = {'?', ' ', 'a', 'm', ' '}; char second[ ] = {'i', 'r', 'o', 'n', 'm', 'a', 'n', '/0'} char result[200]; append (first, 5, second, 8, result); cout << result; Example output for code above:

+3
Answers (1)
  1. 7 September, 16:44
    0
    Check the explanation

    Explanation:

    #include

    #include

    void append (char * first, int n, char * second, int n1, char * result)

    {

    int i, j=0;

    for (i=0; i
    result[i]=first[i];

    for (i=n; i
    {

    result[i]=second[j];

    j++;

    }

    }

    void main ()

    {

    char first[]={'I', ' ','a', 'm', ' '};

    char second[]={'i', 'r', 'o', 'n', 'm', 'a', 'n','/0'};

    char result[200];

    append (first, 5, second, 8, result);

    cout<
    cout<
    system ("pause");

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Concatenating arrays Strings have build-in functions to perform concatenation. Write a function called append () that performs ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers