#Why doesn't \n print out the Buffer?
1 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
You can force to flush the buffer by using fflush(stdout)
'\n' is just a character, doesn't force C to actually print it yet
However it is interesting that you don't see the Number: output, it usually would appear or at least I don't really know why it wouldn't.
Anyway, try it with the fflush, that'll work for sure
It only showes up, when I enter a Number and then press enter.
But thx for your help
#include <stdio.h>
int main(int argc, char **argv) {
printf("Number: \n");
fflush(stdout);
int number;
scanf("%d", &number);
printf("%d", number);
return 0;
}
There, that's how I meant it
Could you try that code and see if it works?
yes it works thx
👍
!solved