I'm trying to do a check in the input of a menu option field but it produces an infinite loop with no exit not allowing me to insert in the stdin.
MENU
int operationNum;
    printf("Menu\n"
    "1) Create\n"
    "2) Delete\n"
    "3) Show\n"
    "4) Exit\n");
CHECK INPUT
while (1) {
        printf("--> ");
        if ( scanf("%d", &operationNum) )
            break;
}
OUTPUT (I test wrong value)
--> gf
--> --> --> --> --> --> --> --> --> --> --> --> --> --> (...)
 
     
    