M
M
Muriam2019-04-21 08:28:36
C++ / C#
Muriam, 2019-04-21 08:28:36

How to copy an array in C++?

how to do something similar?
int array[SIZE];
int array2[SIZE] = array.copy();

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vanyamba-electronics, 2019-04-21
@Muriam

#include <vector>
#include <algorithm>
...
std::vector<int> array(SIZE);
std::vector<int> array2(array.size());
std::copy(array.begin(), array.end(), array2.begin());

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question