How can i reverse an ARRAY (from left to right) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i reverse an ARRAY (from left to right)

7th May 2017, 5:30 PM
Amr Almatni
Amr Almatni - avatar
4 Answers
+ 6
int temp; int a [l]; for (int i=0;i <l;i++) { temp=a [i]; a[i]=a[l-i]; a [l-i]=temp; }
7th May 2017, 5:37 PM
Pixie
Pixie - avatar
+ 2
print the array reversely.use decrease for loop array length to zero
7th May 2017, 5:35 PM
R.P.A.Kulatunga
R.P.A.Kulatunga - avatar
+ 2
you can go through the array reversely.Write its own rutine which starts on the end and decrease the array index: for(int ridx=arr.length;ridx>0;ridx--) printf(%d, arr[ridx-1]);
7th May 2017, 6:28 PM
Highman
Highman - avatar
+ 2
بس شوفك بقلك كيف 😆
28th Apr 2018, 2:35 PM
Basel B Ibrahim
Basel B Ibrahim - avatar