How to change the mian function to only call other functions, here is my code
#include
void reverse(int *nums, int n) //this is reverse function body with pointers
{
int *first = nums;
int *last = nums+n-1;
while(first
{
int temp = *first;
*first = *last;
*last = temp;
first++;
last--;
}
printf("Reversed array is:[");
for(int i=0; i
printf(" %d ", *nums++);
printf("]");
}
int main()
{
int a[20],n;//maximum 20 element size of an array
printf("Enter size of array: "); //size of an array
scanf("%d", &n);
printf("Enter elements in array: ");//input array of elements as per size
for(int i=0; i
scanf("%d", &a[i]);
reverse(a, n);//function call to reverse function return 0;
}