CJCoding With Joseph
15per day

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 

Expected Output:

10 20 30 40 50 
Topics:
Arrays
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.