I have the below code,
fflush(stdin); print(\"Enter y/n\"); scanf(\"%c\",&a);
Here,it is quitting before giving the input.it looks like
For C on GNU
you can use
__fpurge(stdin);
include stdio_ext.h header for accessing the function. Though the post is very old still I thought this might help some linux developers.