I have a program that compiled on my i386 running suse linux with
gcc -Wall student.c and runs perfectly.
When trying to compile and run the same program on a unix machine, I am recieving a segmentation fault at the following code
If i remove the unary & operator, there is no segmentation fault, but of couse numRecords is garbage and unusable. I don't understand how this works on one system and not another. Any suggestions?Code:fgets(line, sizeof(line), fp); if(!sscanf(line, "%d", &numRecords)) { printf("File not in the correct format.\n"); exit(1); }
entire source attached.