0

I am not able to get input from the user. Here is the code...

#include <stdio.h>
#include <ctype.h>

int main(){
    .
    .
    .
    char x;
    printf("\nDo you want to exit (Y/N): ");
    scanf("%c", &x);
    if (toupper(x) == 'Y')
    {
        printf("Exiting...");
    }
}

scanf function is not working. Program is automatically exiting without any input.

  • Questions seeking debugging help should generally include a [mre], which includes a function `main` and all `#include` directives. Without complete code, we cannot see in which state the input stream is, at the time your posted code starts executing. – Andreas Wenzel Jan 13 '22 at 17:16

0 Answers0