Im trying to store ints and floats from a file to an array. Im not sure why its not reading the values. It just keeps giving me all 0s. I tried with a different .txt file(same format) but I got the same result. I thought this would work but i cant figure out why it wont work. This is what I currently have:
int main(int argc, char *argv[]){
struct TData{
    int MinIndex,MaxIndex,Points;
    float *pValue;
    } Input[2],Output;
    FILE *fp;
    char ch;
    int i,*values;
    int lines=0;
    fp = fopen(argv[1],"r");
    if(fp == NULL){
            printf("dont do anything\n");
    }
    else{
            while(!feof (fp)){
                    ch = fgetc(fp);
                    if(ch == '\n'){
                            lines++;
                    }
            }
            values = malloc(sizeof(int) * (lines));
            Input[0].pValue = malloc(sizeof(float) * (lines));
            for(i=0;i<lines;i++){
                    fscanf(fp, "%d %f",&values[i],&Input[0].pValue[i]);
                    printf("%d  %f\n\n",values[i],Input[0].pValue[i]);
            }
    }
What the file contains:
3   3.0000000
2   2.0000000
1   1.0000000
The output I am getting:
0   0.0000000
0   0.0000000
0   0.0000000
 
    