Can anybody explain to me why the second Array is getting a value from the first set??
My keylist.txt file is simply "2 14 74 8 36 4 11" but for some reason it keeps assigning the '2' value to the second array.
*********************************************
Code:
#include <stdio.h>
int main(){
int keylist[6], guess_list[6], game = 1;
char file_name[30];
FILE * ifp;
for(int i = 0; i<7; i++){
keylist[i] = 0;
guess_list[i] = 0;
}
ifp = fopen("keylist.txt", "r");
for(int i=0; i<7; i++){
fscanf(ifp, "%d", &keylist[i]);
}
for(int i=0; i<7; i++){
printf("%d, %d\n", keylist[i], guess_list[i]);
}
return 0;
}
*********************************************