+ 1
Can arrary be copied using assignment operator?If possible how?
Condition the is you have two array let a[] and c[] and a[] have some values stored and you should copy those value in c[] without loop.
4 Antworten
+ 2
#include <algorithm>
#include <iterator>
#define arr_size 10
some_type src[arr_size];
// ... some_type
dest[arr_size];
std::copy(std::begin(src), std::end(src), std::begin(dest));
+ 2
Found it on Stackoverflow :)
https://stackoverflow.com/questions/16137953/is-there-a-function-to-copy-an-array-in-c-c#16137995
+ 2
Arrays are containers of multiple data, I think it will be hard (or maybe impossible) to copy the content of one array to another without looping over each element of the array : )
+ 2
Thank You all