What I want/need to accomplish is to read multipliable numbers within a text file.
I'm still a beginner to programming, and I'm unsure what to do.
Here's what my text file looks like:
23 35 93 55 37 85 99 6 86 2 3 21 30 9 0 89 63 53 86 79
Here's what my code looks like:
FILE* infile = fopen("Outputnum.txt", "r");
for(int i=0; i<20; i++){
fscanf(infile, "%d", &outputnum);
return outputnum;
}
Keep in mind I have this code within a function, as my main goal is to read each number in the text file and record the smallest, and second smallest numbers. (Which is only 20 numbers) I figured a for-loop would be the best way to approach this problem, but I'm only returning my first number within the text file. (I'm trying to avoid using array's as it crashes my terminal)