I am trying to add values that I read from input file using fscanf. There are 15 float values that were read from .txt file.
Im copying some of the code here
#define MAX 15
for (i = 0; i < MAX; i++)
{
fscanf(ifp, "%f", array[i].miles);
}
Then I have to add up those 15 float values and store it in some variable.
Im trying to use for loop here
int miles;
for (i = 0; i < MAX; i++)
{
miles += array[i];
}
This wont store those 15 float value in miles. When I print miles, I get garbage value not added figure.
Just need some hint on this
thanks