In this tutorial we will learn to Reverse Array Elements Using Function In C++. Array is a variable which can store multiple element of same data type.Manipulation of array is a very necessary step for any project. In this program we will take input from user, store it in a array then print the reverse array element.
C++ Program To Reverse Array Elements Using Function
#include
#include
void Reverse_Array(int array[],int size);
void main()
{
int i,a[10],size;
clrscr();
cout<<"Enter size of Array ( Max:10 ): ";
cin>>size;
cout<<"\nEnter any "<>a[i];
}
cout<<"\nStored Data in Array: \n\n";
for(i=0;i=i;size--,i++)
{
temp=array[i];
array[i]=array[size];
array[size]=temp;
}
}
Output
Enter size of Array ( Max:10 ): 5
Enter any 5 elements
4
7
8
3
9
Stored Data in Array:
4 7 8 3 9
Reversed Array Elements are:
9 3 4 7 8