I must be making a simple mistake but I can't seem to find out what I'm doing wrong. Here is my problem: I'm reading data from a file into an array, but the values are only being written into the first cell of the array - the array is not incrementing like I think it should. The print statement is working an prints the contents of the file correctly but the "data array" is not filling up.
Code:char fileName[100]; int data[100]; FILE* sp; sp = fopen(fileName,"r"); while(k=(fscanf(sp,"%i",data) == 1)){ printf("%10i\n",*data); b += k++ ;



LinkBack URL
About LinkBacks



