C03 Answer
#include <stdio.h>
#include <stdlib.h>
/* Puzzle C03 - fill an array by making each element the same integer x */
void fillArrayConst( int arr[], int size, int x )
{
int j;
for ( j=0; j<size; j++ )
{
arr[j] = x;
}
}
void printArray( int arr[], int size )
{
const int N = 10;
int j;
for ( j=0; j<size; j++ )
{
if ( j%N == N-1 )
printf("%4d\n", arr[j] );
else
printf("%4d ", arr[j] );
}
}
const int SIZE = 100;
int main(int argc, char *argv[])
{
int x[ SIZE ];
fillArrayConst( x, SIZE, 7 );
printArray( x, SIZE );
printf("\n");
system("PAUSE");
return 0;
}