#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("hello world\n");
printf("hello\rworld\n");
printf("hello\r\nworld");
printf("hello world\r\n");
return 0;
}
输出结果为:
第一行: 遇到\n换行
第二行: 遇到\r 换行,但前移到改行的行首位置,因此覆盖前面的hello
第三行: 遇到\r\n 换行,并且光标移到下一行的行首位置
第四行:
\n是换行 newline 跳到下一行,列位置不变
\r 换车 但是不换行 光标移到该行的行首位置,
\n 回车 换行 ,光标移到一下行,但未必是行首\r\n 回车 换行 光标移到一下行, 并且光标移到下一行的行首位置
\b 标识空格