I'm learning c and I got stuck in some codes as below from a tutorial.
#include <stdio.h>
int main() {
fprintf(stdout, "This is to stdout. ");
fprintf(stderr, "This is to stderr. ");
fprintf(stdout, "This is also to stdout. ");
}
and the result they got is
This is to stderr. This is to stdout. This is also to stdout.
which is out of order but what I got is
This is to stdout. This is to stderr. This is also to stdout.
which is in order. So that's so weird, Why I got a different result? (the tut I refer to is https://www.journaldev.com/39049/fflush-in-c)