Reverse Array In C

Introduction
  •  In this blog, i am going to explain how to reverse an array.
Software Requirements
  •  Turbo C++ or C. 
Programming
  1. #include < stdio.h >   
  2. int main()  
  3. {  
  4.     int n, c, d, a[100], b[100];  
  5.     printf("Enter the number of elements in array\n");  
  6.     scanf("%d", & n);  
  7.     printf("Enter the array elements\n");  
  8.     for (c = 0; c < n; c++) scanf("%d", & a[c]);  
  9.     for (c = n - 1, d = 0; c >= 0; c--, d++) b[d] = a[c];  
  10.     for (c = 0; c < n; c++) a[c] = b[c];  
  11.     printf("Reverse array is\n");  
  12.     for (c = 0; c < n; c++) printf("%d\n", a[c]);  
  13.     return 0;  
  14. }   
Explanation
  •  In the programming given above, it is easily understood that the array is reversed and the output can be printed.

    programming 
Output

Output
Next Recommended Reading Print Alternate Elements In An Array