A question of shortcuts | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

A question of shortcuts

What does "\r" do in c++?

30th Dec 2020, 5:07 AM
Mohammad Al_Ayoubi
Mohammad Al_Ayoubi - avatar
1 Answer
+ 4
Mohammad Al_Ayoubi \r is a carriage return character; it tells your terminal emulator to move the cursor at the start of the line. The cursor is the position where the next characters will be rendered. So, printing a \r allows to override the current line of the terminal emulator.. Read this : https://stackoverflow.com/questions/7372918/whats-the-use-of-r-escape-sequence#:~:text=%5Cr%20is%20a%20carriage%20return,line%20of%20the%20terminal%20emulator.
30th Dec 2020, 5:14 AM
Alphin K Sajan
Alphin K Sajan - avatar