C - Пользовательский ввод пропускается?

Я хочу меню, из которого вы выбираете какое-то действие.

Проблема в том, что когда мы выбираем один и нажимаем клавишу «возврат», команда пользовательского ввода, которая должна была стать следующим шагом, пропускается. Это почему ?

Код является:

#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[])
{
    int choice;

    do
    {
     printf("Menu\n\n");
     printf("1. Do this\n");
     printf("2. Do that\n");
     printf("3. Leave\n");
     scanf("%d",&choice);

     switch (choice)
     {
        case 1:
            do_this();
            break;
        case 2:
            // do_that();
            break;
     }

    } while (choice != 3);

    return(0);
}

int do_this()
{
    char name[31];

    printf("Please enter a name (within 30 char) : \n");
    gets(name); // I know using gets is bad but I'm just using it

    // fgets(name,31,stdin); // gives the same problem by the way.

    // Problem is : user input gets skiped to the next statement :
    printf("Something else \n");

    return(0);
}

Ответы на вопрос(2)

Ваш ответ на вопрос