C19 Answer


/* Puzzle C19 -- clamping: change all integers
   greater than X to X and all integers less than -X to -X */

void clamp( int arr[], int size, int x )
{
  int j;
  for ( j=0; j<size; j++ )
  {
    if ( arr[j] < -x )
      arr[j] = -x;
    else if ( arr[j] > x )
      arr[j] =  x;
  }
}