Hello to all. I am trying to read from a file, weather.txt, into an array (using functions), and print that array once created. I believe I have before and after main done correctly, but the content of main I am lost on. I have never been good at functions, so that's why I am trying this, to learn more.
What I have so far:
This runs with no error, but does nothing (which makes sense, as there is no code in main). I just don't understand how to read and place into an array. A C reference book I looked at said to use:
const int nbr_months = 12;
const char weather_file  = "weather.txt";
FILE * fptr;
int loadstats(FILE * wfile, weather_t wstats);
void printstats (weather_t wstats);
//I have opened the file, but how do I place it into the array?
int loadstats(FILE * wfile, weather_t wstats)
for(k = 0; k < nbr_months; k++)
fscanf(fptr, "%i%i%i%f", &wstats[k]);
to read from a file into an array. So I think for formatring I would place , because what I wish to read contains three ints and a float, but I am not sure. As well, I don't understand what this piece of code means by destination(addresses), or if it is right at all to use such code. Thank you all for any help you can give!
int = fscanf(FILE * , formatstring, list of destination(addresses));