sizeof(arr)
is the size of the pointer, as arr is defined struct Record *
. Divided by the size of one struct Record
this is most probably 0.
Assuming your file contains only records, and you're reading the whole file, use size->st_size/sizeof(struct Record)
. Or even better, as you're probably going to need the number of records somewhere else anyway, set a variable after reading the input file and use that variable.