How to rewrite numbers from first array to second array? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to rewrite numbers from first array to second array?

24th Nov 2017, 7:52 PM
Irina
2 Answers
+ 4
Even easier method, if you are on a newer compiler : #include<algorithm> int main() { int a1[5],a2[5]; std::copy(a1,a1+5,a2); for( int i : a2 ) cout<<i; } Note that a2 must have a size that can hold the number of elements specified for copying.
25th Nov 2017, 4:54 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 1
you mean transfer elements from array to another? for(i=0;I<array1.length;i++) {array2[I]=array1[I]}
24th Nov 2017, 7:55 PM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar