Write the definition of a function reverse , whose first parameter is an array o
ID: 3641985 • Letter: W
Question
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.
So far I have this and it's telling me that I am not reversing all the elements. I think it might be an offset issue.
My code so far:
void reverse (int a[], int x)
{
int swap;
for (int i=0; i<=x; i++)
{
swap = a[i];
a[i] = a[x];
a[x] = swap;
}
return;
}