← Back to STL Containers
Question 534
Copying a std::array
Copying a std::array
The code already createsarray<int, 3> a = {1, 2, 3};, copies it witharray<int, 3> b = a;, and then changesb[0]to 99. Print two lines: the texta[0]:, a space and the first element ofa, then the textb[0]:, a space and the first element ofb.
Expected Output:
a[0]: 1 b[0]: 99
= newline. The output ends with a newline — print one after the last line.
Hints2 available
Sign in to use hintsTopics:
STL Containersstd::array
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.