Answer to your question about, why we use getch();
So getch(); is simply a short form to get character. Character or char is a datatype in C for special character.
So simply, getch(); is nothing but holding the program to get a character from the user.
When the program finishes all the lines of code, after getch(); it waits for the user to give a character and once user gives a character it terminates.
What if their is no ‘getch();’?
If their is no getch(); then the program will terminate just after the last line, which means if you gave a ‘printf();’ command, the user will not able to read it as the program is terminated before that.
It was a small thing that is really important for you to understand.