so I was trying to program my first project on my own and already have some troubles concerning the getchar()-function.
What I want to do is to get user input without having to press enter. The user-input than should "activate" the case equivalent to the input (e.g. input = case = 1). Instead of that I still have to press enter but then only the default-command gets called.
I saw, that there are some questions about it but non of them really helped me out. here is my code:
#include <stdio.h>
#include "open_txt.h"
int main (){
    printf("\n\n\tAdressbook\n\n");
    printf("Main menu: \n\n");
    printf("1. Add contact\n");
    printf("2. Edit contact\n");
    printf("3. Search contact\n");
    int ui;
    ui = getchar();
    switch(ui){
        case 1:
            printf("\n\nADD CONTACT\n\n");
            break;
        case 2:
            printf("\n\nEDIT CONTACT\n\n");
            break;
        case 3:
            printf("\n\nSEARCH CONTACT\n\n");
            break;
        default:
            printf("That's not an option!\n");
    }
    return 0;
} 
 
     
    