Yeah so I have coded this really simple program using one structure, with the information being scaned in to the structure from a seperate file called poeple.dat.
Within my master while loop im printing the character array g1.names[i]. For some reason I cant figure out, I am getting a segmentation fault after exiting the master while loop. All information is scaned in successfully yet the program always ends in a segmentation fault.
My code is this
#define FILENAME "poeple.dat"
int var1, var2, var3, var4;
struct building g1;
people = fopen(FILENAME, "r");
fscanf(students,"%i%i%i%i",&g1.var1, &g1.var2, &g1.var3, &g1.var4);
my output always looks like this
Ive rebuilt this code many times and completely analysed this code but cant figure out for the life of me whats wrong.
Testah Segmentation fault
any help would bo much appreciated, thanks.