fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // your code goes here
  5. int arr[5]={1,2,3,4,5};
  6. int temp;
  7.  
  8. for(int i=0;i<2;i++){
  9. temp=arr[i];
  10. arr[i]=arr[4-i];
  11. arr[4-i]=temp;
  12.  
  13. }
  14. printf("Reversed array:");
  15. for(int i=0;i<5;i++){
  16. printf("%d",arr[i]);
  17. }
  18.  
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0.01s 5272KB
stdin
Standard input is empty
stdout
Reversed array:54321