Hello, I am really new to writing C code. I am generally written Java code all my life, so I am struggling with C code as this is the second program I am writing in C. I am trying to read a txt file that has numbers in the format of 12 145 156 1263 1342 1642 I am trying to read these in and storing them into my array. I tried two different ways, but it's not working. The loop just runs forever and prints 0s and random values. while((fscanf(file, "%d\n", &allInstructs[count]) != EOF)) { printf("Running %d\n", allInstructs[count]); count++; } Thanks again!
The code you have shown looks file to me. Make sure that you initialise count to zero before you start the loop.