| | One problem often encountered with scanf( ) occurs when programmers try to use it in conjunction with various other character input functions such as getc( ), getch( ), getchar( ), gets( ), and so on. The typical scenario goes like this: scanf( ) is used to input various data types that would otherwise require conversion from characters to something else. Then the programmer tries to use a character input function such as getch( ) and finds that getch( ) does not work as expected. The problem occurs because scanf( ) sometimes does not read all the data that is waiting to be read, and the waiting data can fool other functions (including scanf( )) into thinking that input has already been entered. To be safe, if you use scanf() in a program, don’t also use other input functions in the same program. | | |