When does printf fail to print?

后端 未结 5 1955
梦谈多话
梦谈多话 2020-12-17 10:42

printf function in c doesn\'t always print the output on screen. For example if you forget to put \\n at the end of string you are printfing you sometimes don\'t get the o/p

5条回答
  •  执念已碎
    2020-12-17 11:33

    Standard out is a buffered stream, it is not guaranteed to flush unless a newline is put in, the stream is closed, or the program exits normally. If the program exits abnormally, it is possible for the stream to not flush. Standard out is line buffered, which is why a newline will flush it. There are buffers that will not flush with a newline.

提交回复
热议问题