Try matsp's suggestion first. stdout is not supposed to be fully buffered when it refers to the command prompt's display, but it could somehow be fully buffered on your machine.
By the way, if you notice in the code I posted, not only did I use the code formatting tool provided with Code::Blocks, but I commented out that first printf() so as to check if that is exactly what you compiled and tested with. Compile and test with the program I showed you. Perhaps tabstop is right: what you are testing with and what you are showing us could be different, so merely showing us what you showed us may not help.