There is a difference between initialization and assignment . What you want to do is not initialization, but purpose. But such an assignment to an array is not possible in C ++.
Here is what you can do:
#include <algorithm> int array [] = {1,3,34,5,6}; int newarr [] = {34,2,4,5,6}; std::copy(newarr, newarr + 5, array);
However, in C ++ 0x you can do this:
std::vector<int> array = {1,3,34,5,6}; array = {34,2,4,5,6};
Of course, if you decide to use std::vector instead of a raw array.
Nawaz Apr 20 2018-11-11T00: 00Z
source share