dimanche 21 août 2016

Pointers and segmentation faults in C

I'm trying to read some floats from a file into an array I've created defined as such:

float *taps[3];

and I'm reading the floats in from the file as such:

for (i = 0; i < 3; i++) {
fscanf(tapsInput, "%f", taps[i]);
}

I know that segmentation faults occur when a pointer is pointing so something wrong, but I'm not sure what is wrong with my code in this set up.

Aucun commentaire:

Enregistrer un commentaire