How to write a c++ programe copy element of array1 into array2 but in revers order | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to write a c++ programe copy element of array1 into array2 but in revers order

plzzzz tell fast

13th Jul 2018, 3:40 PM
زوار اعجاز
زوار اعجاز - avatar
3 Answers
+ 4
زوار اعجاز Using pointer is needlessly awkward in this case, since what's going on behind the bracket operator is literally dereferencing the content of the array using '*'. But if you are curious about underlying process, then「HAPPY TO HELP」 's snippet can be rewritten as the follow const int Size = 5; int arr1[Size] = {0,1,2,3,4}; int arr2[Size]; int *p1 = arr1; int *p2 = arr2; int j = 0; for (int i = Size - 1; i >= 0; i--) { *(p2 + j) = *(p1 + i); j++; }
13th Jul 2018, 4:55 PM
Babak
Babak - avatar
0
throug pointer dear
13th Jul 2018, 4:01 PM
زوار اعجاز
زوار اعجاز - avatar
0
tnx bro
6th Nov 2018, 6:35 PM
زوار اعجاز
زوار اعجاز - avatar