#include <stdio.h>
#include <stdlib.h>
/* Puzzle D32 -- reverse the elements in an array between
index Low and High */
void reverseArrayRange( int size, int arr[], int low, int high )
{
int j;
int temp;
int length;
/* Adjust out-of-bounds indexes */
if ( low < 0 ) low = 0;
if ( high >= size ) high = size-1;
length = high-low+1;
for ( j=0; j < length/2; j++ )
{
temp = arr[low+j];
arr[low+j] = arr[high-j];
arr[high-j] = temp;
}
}