
LANGUAGE: C++
CHALLENGE:
Write the definition of a function reverse, whose first parameter is an array of integers and whose second parameter is the number of elements in the array. The function reverses the elements of the array. The function does not return a value.
SOLUTION:
void reverse (int a[], int n){ int temp; for (int k=0; k<n/2; k++){ temp=a[k]; a[k]=a[n-k-1]; a[n-k-1]=temp; } }
This is a very helpful website, it will be nice if this website can display the output of the program or functions in question.