#include <stdio.h>
void load_menu(void);
int main(void)
{
    load_menu();
    return 0;
}
void load_menu(void)
{
int choice;
int loopagain;
do
{
    printf("Menu \n\n");
    printf("Please enter your choice: \n");
    printf("1. \n");
    printf("2.\n");
    printf("3.\n");
    printf("4. Exit\n");
    if (scanf("%d",&choice)==1)
    {
        switch(choice)
        {
            case 1:
                    break;
            case 2:
                    break;
            case 3:
                    break;
            case 4: printf("Quitting program!\n");
                    break;
            default: printf("Invalid choice! Please try again\n");
                    printf("\n");
                break;
        }
    }
    else
    {
        printf("Characters are invalid, please enter a number: \n ");
        if (scanf("%d",&loopagain)==1)
            load_menu();
    }
}while((choice !=4));
}
why is this still giving me an infinite loop when I enter a character? It is a menu (the case statements still need to be filled) but i am taking care of the character input by the if statement but it still does not seem to work. Thanks
 
     
     
     
     
     
    