You are viewing a single comment's thread. Return to all comments →
Actually, there is a problem with the code. The line char t12; in the original post doesn't allocate enough space. The string "PM" requires three bytes: 'P', 'M', and a null (zero) byte to end the string. When the machine writes three bytes into a two-byte space, that final null byte is stomping over memory that doesn't belong to the t12 variable. What happens then is very hard to predict, dependent on the implementation and other factors.
The quick fix would be to correctly declare t12 as char t12;.
Thanks bro ! I have made the suggested correction in the main code.