C37 Answer
/* Puzzle C37 -- shift every array element N positions right; */
/* the first N elements get 0 */
void shiftRightNArray( int arr[], int size, int shift )
{
int j;
/* If the shift amount is zero or negative, do nothing */
if ( shift<=0 ) return;
/* If the shift amount is more than the number of elements, */
/* zero the array */
if ( shift>=size )
{
for ( j=0; j<size; j++ )
arr[j] = 0;
return;
}
/* Copy elements into their new locations */
for ( j=size-1; j>=shift; j-- )
arr[j] = arr[j-shift];
/* Zero the first N slots */
for ( j=0; j<shift; j++ )
arr[j] = 0;
}