Here's a working example, in an online C language IDE, where you can substitute in some test values of lat and lon and see if the calculations are correct.
It appears to me that this code is designed for full decimal values of the GPS coordinates, not a DMS format such as ddmm.ssss.
I also changed the initial values of MH[4]/MH[5] to be 'a' instead of 'A' since I've seen that the third subdivision normally designated with lower case characters.