122. WAP to reverse the elements of given array
#include<stdio.h>
int
a[10]={1,2,3,4,5,6,7,8,9,10},ele,i,j;
void
main()
{
ele=sizeof(a)/sizeof(a[0]);
for(i=0,j=ele-1;i<j;i++,j--)
{
a[i]=a[i]^a[j];
a[j]=a[i]^a[j];
a[i]=a[i]^a[j];
}
for(i=0;i<ele;i++)
printf("%d ",a[i]);
}
Comments
Post a Comment