Forum Discussion
Altera_Forum
Honored Contributor
12 years agohow to flush stdin buffer between two scanf?
Hi, I think this is a beginner-level question. Much appreciate your answers in advance! The following is my simple C-code: #include <stdio.h># include <string.h>
void main(void)
{
...
Altera_Forum
Honored Contributor
12 years agoAny if I now type "yes" the program will crash.
The simple solution is never to use scanf, and especially never with a %s format.