What is the difference between \r and \n?

后端 未结 9 2326
庸人自扰
庸人自扰 2020-11-22 06:20

How are \\r and \\n different? I think it has something to do with Unix vs. Windows vs. Mac, but I\'m not sure exactly how they\'re different, and

9条回答
  •  不要未来只要你来
    2020-11-22 07:04

    \r is used to point to the start of a line and can replace the text from there, e.g.

    main()
    {
    printf("\nab");
    printf("\bsi");
    printf("\rha");
    }
    

    Produces this output:

    hai
    

    \n is for new line.

提交回复
热议问题