c语言中\n和\r有什么区别
12个回答
展开全部
\t表示8个字符后对齐
\n表示换行
例如你输入printf("ab\t1");
printf("abc\t1");
输出结果为
ab 1
abc 1 //ab后面有6个空格 ,abc后有5个空格,因为他们和空格加起来是8个字符
注意:如果\t前面的内容超过8个字符则后面自动隔8个空格
\n表示换行
例如你输入printf("ab\t1");
printf("abc\t1");
输出结果为
ab 1
abc 1 //ab后面有6个空格 ,abc后有5个空格,因为他们和空格加起来是8个字符
注意:如果\t前面的内容超过8个字符则后面自动隔8个空格
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
enter+newline with different platforms:
windows: \r\n
mac: \r
unix/linux: \n
in "abc" + ”\n\rdef”, \n\r do not match any platform,so it is considered as \n and \r (which match unix/linux and mac),so there are two new lines.
in "abc" + ”\r\ndef” \r\n matches the windows platform,so it is considered as only one new line.
scim crushed, so just English.
windows: \r\n
mac: \r
unix/linux: \n
in "abc" + ”\n\rdef”, \n\r do not match any platform,so it is considered as \n and \r (which match unix/linux and mac),so there are two new lines.
in "abc" + ”\r\ndef” \r\n matches the windows platform,so it is considered as only one new line.
scim crushed, so just English.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询