because when you use
yesno(getch());
It expands to :
(getch()==ENTER || getch()==' ' || getch()=='\t') ? ENTER : ESC`
When the macro is expanded like this, it means that getch()
could actually be called 1, 2 or 3 times because the logical ||
means:
getch() == '\n' ? if true return ENTER, false test next one
getch() == ' ' ? if true return ENTER, false test next one
getch() == '\t' ? if true return ENTER, false return ESC
If you use the gcc
compiler you can find out what your macro expands to by using the -E
flag:
gcc -E myprog.c -o mprog.m