c program not working
Hello,
I'm having trouble reading data from a file into an array. This is what I have done:
int dataNum = 25; double array[100];
if((fread(array, sizeof(array), dataNum, inputFile)) != dataNum)
{
if(feof(input)) printf("Data items in file are less than %d.\n", dataNum);
else printf("File read error.\n");
return 1;
}
All the variables are declared and the file opens correctly, but when I run it, it crashes.
I'm having trouble reading data from a file into an array. This is what I have done:
int dataNum = 25; double array[100];
if((fread(array, sizeof(array), dataNum, inputFile)) != dataNum)
{
if(feof(input)) printf("Data items in file are less than %d.\n", dataNum);
else printf("File read error.\n");
return 1;
}
All the variables are declared and the file opens correctly, but when I run it, it crashes.
0