I learned that stdout is line buffered, and buffer is automatically flushed under several circumstances (1) when the buffer is full, (2) when print a \n character and the output is going to a "terminal" (e.g. is not being redirected to a file), (3) when the program exits, and (4) when the program is waiting for input. but when I use printf without \n ,without fflush in a while loop,it outputs normally in every iteration,do I misunderstands how printf or fflush works? code was compiled and run on windows,I tryed the same code on ubuntu machine,it works fine,so is it a problem with terminal on windows?
int main(){
int a=10;
while(a--){
printf("hello world");
sleep(1);
}
return 0;
}