change this program to open a file
how would i change this function of my program to open a file named "numbers"? i know i would get rid of the srand and the part dealing w/ rand. also, do i declare FILE *fptemp in this function or in main?
Code:
/* =============== fillArray ===================
This function fills an array of a given length with
random numbers in a given range.
Pre ary is an ary of integers
size is the number of elements
lowLimit is the minimum value to use
highLimit is the maximum value to use
Post array has been filled
*/
void fillArray (int ary[], int size,
int lowLimit, int highLimit)
{
/* Local Definitions */
int i;
int num;
/* Statements */
srand (time (NULL));
for (i = 0; i < size; i++)
{
num = rand() % ((highLimit + 1)
– lowLimit) + lowLimit;
if (num % 7 == 0 || num % 3 == 0)
ary[i] = -num;
else
ary[i] = num;
} /* for */
return;
} /* fillArray */
thanks