Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in C Programming by (120 points)
Can anyone provide me a c++ program to combine two arrays such that the odd positions of the combined array consist of the elements of the first array and the even positions consist of elements from the second array?

1 Answer

0 votes
by (26.4k points)

Try the following code:

for(int i = 0; i < 150; ++i){

    c[i][0] = a[i];

    c[i][1] = b[i];

}

This code will helps you to merge two arrays into one for the following code:

int A[150],B[150];

int C[150][2];

Interested to learn more about C Programming? Come and join: C Programming course

Related questions

Browse Categories

...