how to correctly clear a buffer before read in C code example
Example: c clear buffer
void clearBuffer() {
char c;
do {
c = getchar();
} while (c != '\n' && c != EOF);
}
void clearBuffer() {
char c;
do {
c = getchar();
} while (c != '\n' && c != EOF);
}