I feel really stupid by asking such question

I have the following code

char choice;
while( ( choice = MenuChoice() ) != 'QUIT' )
         switch (choice)
        case STRING:
        case 's':

        case QUIT:


char MenuChoice(void)

char menuchoice;
printf("please enter:");

scanf("%c", &newLine);

return menuchoice;


When I enter 's' as an input it keeps repeating the please enter: enter until I put two 's' like ss.
Why is this happening?

Thanks its much better. But when I put 4 for QUIT as mentioned in while statement, it will keep asking me for input/

QUIT was defined as 3. Do I have to define as an character also like #define QUIT q

if QUIT is defined like this: #define QUIT 3 Then while( ( choice = MenuChoice() ) != 'QUIT' ) will not work. You have to make two changes
1) QUIT should be defined as '3'
2) The while loop should be changed as shown below

#define QUIT   '3'
while( ( choice = MenuChoice() ) != QUIT )

>>But when I put 4 for QUIT
You entered the wrong value -- should be 3 not 4

Ok thanks. But what if user is entering character as an input, like

please enter: q
This question has already been answered. Start a new discussion instead.