#include <stdio.h>
#define SIZE 100
int
array_from_file (double a[], int size)
{
int i;
FILE* in;
in = fopen ("data_array.dat", "r");
i=0;
while (i < SIZE && fscanf (in, "%lf", &a[i]) != EOF)
{
i=i+1;
}
fclose (in);
return (i);
}
int
main (void)
{
double array[SIZE];
int actual_size, i;
actual_size = array_from_file (array, SIZE);
for (i=0; i < actual_size; ++i)
printf ("%3.1lf ", array[i]);
printf ("\nThe array contains %d values ", actual_size);
printf ("for a capacity of %d cells.\n", SIZE);
return (0);
}