How to merge two arrays in C++?

Viewed 42

How to merge two arrays into one in C++?

# include <iostream>

int main()
{
    int Z[5] = {1,3,5,7,9};
    int Y[5] = {2,4,6,8,10};
    int X[10]; // Merge array Z and Y to X

That is, do I use + to merge array in the following code example?

int X[10] = {Z[5]+Y[5]};

Or is this solution wrong?

0 Answers
Related