best approach c menu terminal

#include <stdio.h>

void displayMenu() {
    printf("1. Option 1\n");
    printf("2. Option 2\n");
    printf("3. Option 3\n");
    printf("4. Quit\n");
}

int main() {
    int choice;

    do {
        displayMenu();
        printf("Enter your choice: ");
        scanf("%d", &choice);

        switch (choice) {
            case 1:
                printf("You selected Option 1\n");
                // Add functionality for Option 1
                break;

            case 2:
                printf("You selected Option 2\n");
                // Add functionality for Option 2
                break;

            case 3:
                printf("You selected Option 3\n");
                // Add functionality for Option 3
                break;

            case 4:
                printf("Quitting the program\n");
                break;

            default:
                printf("Invalid choice. Please enter a number between 1 and 4.\n");
        }

    } while (choice != 4);

    return 0;
}