Reverse an Array in C Program

C Program to reverse an Array

This below C program will just reverse the given array. This can be done by using for loop. When you run the below program it will ask you the size of the array and then the program will ask you to enter the numbers. after that the array reverse logic will happen. after that the array in reverse order will be printed.

int main(){
int n, i, j, temp, a[100];
printf("Enter the Array Size");
printf("Current Array Element");
for ( i = 0 ; i < n ; i++ )
if( n%2 == 0 )
i = n/2 - 1;
i = n/2;
for ( j = 0 ; j < i ; j++ ){
temp = a[j];
a[j] = a[n -j - 1];
a[n-j-1] = temp;
printf("Array in Reverse Order
for( i = 0 ; i < n ; i++ )
return 0;

Related Topic How to Reverse an Array in Java Program
Reverse a String in C Program
php reverse array
Reverse Array C Program Language
Reverse an Array in Perl 2011   Privacy Policy  Terms of Service  Feedback