Answers for "how to clear a char buffer in c"

C++
0

c clear buffer

void clearBuffer() {
	char c;
	do {
		c = getchar();
	} while (c != '\n' && c != EOF);
}
Posted by: Guest on April-04-2021
1

remove buffer after char in c

use fflush()
write a function like this: void clear (void) { while ( getchar() != '\n' ); }
Posted by: Guest on August-09-2021

Browse Popular Code Answers by Language