I have a function to reverse an array and I think there are some issues with the same. Please guide me in the right path to get this sorted out.
Function:
void reversearr (int arr[], int arrlen)
{
int a, b, arrtemp[arrlen];
b=arrlen;
for (a=0; a<=arrlen; a++)
{
arr[a] = arrtemp[b];
b--;
}
printf("\nthe reversed array is");
for(b=0; b<arrlen; b++)
{
printf("%d",arrtemp[b]);
}
}
the function is called in this way
reversearr(arr,max);
1 Answer