fork download
  1. #include <stdio.h>
  2.  
  3. int reverse(int a[], int n)
  4. {
  5. int i,b;
  6. for(i=0; i<n/2; i++)
  7. {
  8. b=a[i];
  9. a[i]=a[n-1-i];
  10. a[n-1-i]=b;
  11. }
  12. return 0;
  13. }
  14.  
  15. int main(void) {
  16. int a[]={1,3,4,6,8,9},i,n=6;
  17.  
  18. reverse(a,n);
  19.  
  20. for(i=0; i<n; i++)
  21. {
  22. printf("%d ",a[i]);
  23. }
  24.  
  25. // your code goes here
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
9 8 6 4 3 1