0
How to write a c++ programe copy element of array1 into array2 but in revers order
plzzzz tell fast
3 ответов
+ 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++;
}
0
throug pointer dear
0
tnx bro