fixes a "bug" with the buffer thing..
This commit is contained in:
parent
bcee4d33d2
commit
37640a0c84
1 changed files with 1 additions and 0 deletions
1
main.c
1
main.c
|
|
@ -125,6 +125,7 @@ int main() {
|
||||||
printf("\n\nINPUT BELOW:\n"); // DIVIDER
|
printf("\n\nINPUT BELOW:\n"); // DIVIDER
|
||||||
char fruit[20]; //MAX 20 CHARACTERS
|
char fruit[20]; //MAX 20 CHARACTERS
|
||||||
printf("Pick a fruit: ");
|
printf("Pick a fruit: ");
|
||||||
|
fflush(stdout); // this forces the buffer to print NOW, fixing the "bug" in which it prints out everything AFTER the next line (scanf)
|
||||||
scanf("%s", fruit);
|
scanf("%s", fruit);
|
||||||
printf("\nYou choose %s as your fruit!", fruit);
|
printf("\nYou choose %s as your fruit!", fruit);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue