Ankur Jain Kothari wrote:ok...but what if i want to enter 1 first...then computer asking me to type the second number and then i type 2 and then Enter.? Can this be possible? how can we do this with getchar? here with getchar, it reads the first charachter and then 2nd charachter upon being called again...?
i hope my question is clear
any specific reason that you want only getchar()? you can very well use scanf or fscanf to get user input, one at a time, and parse them in whatever way you want or validate them before using them.