clear buffer c code example
Example 1: c++ flush stdin
fflush(stdin);
Example 2: c clear buffer
void clearBuffer() {
char c;
do {
c = getchar();
} while (c != '\n' && c != EOF);
}
fflush(stdin);
void clearBuffer() {
char c;
do {
c = getchar();
} while (c != '\n' && c != EOF);
}