Strings | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Strings

What is the difference between \n and \r ??

25th May 2017, 9:35 PM
kazuto
1 Answer
+ 6
'\r' is carriage return(CR). '\n' is line feed(LF) Both '\n' and '\r' mean newline. However, these two are different character code. Character codes used for new lines are different for each OS. for examle, Windows CR + LF linux LF if you create a program intended for cross-platform, you may need to consider this.
25th May 2017, 10:58 PM
Suyasa
Suyasa - avatar