> int i;
This is uninitialised, so when you use it to access an array, who knows what happens.

> while(!feof(mf))
See the FAQ for why using feof() to control a loop is bad.

> ...