Carriage return in C?

前端 未结 3 1489
执念已碎
执念已碎 2020-12-07 16:43

Output of Following program is : hai

I didn\'t get how the \\r carriage return works in this program and in real can any one help me out

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-07 17:24

    Step-by-step:

    [newline]ab

    ab
    

    [backspace]si

    asi
    

    [carriage-return]ha

    hai
    

    Carriage return, does not cause a newline. Under some circumstances a single CR or LF may be translated to a CR-LF pair. This is console and/or stream dependent.

提交回复
热议问题