I expect that you will appreciate the complexity of this particular Keypad being managed by a Smart Library. I could not find any other control structures other than if-else to control the described behavior of the Keypad. There are nested if-else structures which have created problem on the easy exit to the beginning of Keypad polling/scanning. Use of goto statements have taken care of the affairs; but, I am trying to avoid its use as there are a lot of gross complains against it.
I am a bit reluctant to use the state machine concept as the behavior of the system is not being controlled by any of the past events; rather, it creates some run-time variables that control the future behavior of the system; for example, the flags.
I would like to manage the system using simple C codes as it is an academic project and is meant mainly for the undergraduate level pupils.
Thanks for the interest and guidance.