+ 1

trying to reverse an array.can you find the problem?

https://code.sololearn.com/ca6VOcXAasRp/#c

30th Apr 2018, 12:57 PM
Tanvir Hasan
Tanvir Hasan - avatar
3 Answers
+ 8
for(i=2;i>=0;i--) { printf("%d\n",ara[i]); }
30th Apr 2018, 1:07 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 7
Modify the first for loop and use i <= j as a condition instead of i <= 2. for(i = 0, j = 2; i <= j; i++, j--)
30th Apr 2018, 1:11 PM
Dev
Dev - avatar
1st May 2018, 6:06 AM
Tanvir Hasan
Tanvir Hasan - avatar