CJCoding With Joseph
15free / daySign inCreate account

Copy Array to Another Array

An array called nums has already been created for you with the values {10, 20, 30, 40, 50}. A second empty array called copy has been declared with size 5.

Your task is to copy every element from nums into copy, then print all elements of copy on one line separated by spaces.

In C++, you cannot copy an entire array with a single statement like copy = nums. You must use a loop to copy each element one at a time: copy[i] = nums[i].

Expected Output:

10 20 30 40 50 

= newline. No newline after the last line.

Hints2 available
Topics:
Arrays
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.