Write a ‘C’ program to accept ‘n’ number from user, store these numbers into an array and reverse an array elements using function.
#include<stdio.h>
#include<conio.h>
void rev(int*,int);
void main()
{
int a[30],i,n;
clrscr();
printf("ENTER THE RANGE VALUE");
scanf("%d",&n);
printf("ENTER THE NO");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
rev(&a[0],n);
getch();
}
void rev(int *p,int x)
{
int i;
printf("\nSORTED ELEMENTS ARE\n");
for(i=x-1;i>=0;i--)
{
printf("\n%d",*(p+i));
}
}
#include<stdio.h>
#include<conio.h>
void rev(int*,int);
void main()
{
int a[30],i,n;
clrscr();
printf("ENTER THE RANGE VALUE");
scanf("%d",&n);
printf("ENTER THE NO");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
rev(&a[0],n);
getch();
}
void rev(int *p,int x)
{
int i;
printf("\nSORTED ELEMENTS ARE\n");
for(i=x-1;i>=0;i--)
{
printf("\n%d",*(p+i));
}
}