Write a C program to illustrate \r escape sequence

0

Here is an example of a C program that uses the \r escape sequence to move the cursor back to the beginning of the line:


When the program is run, it will output "Goodbye World!" , the cursor will move back to the beginning of the line, erasing "Hello World!" and replacing it with "Goodbye World!".


The \r escape sequence is used to move the cursor back to the beginning of the current line. It can be used in strings passed to functions like printf() and puts().


It is platform-independent and will work the same way on all operating systems and terminals.


It can also be used to overwrite the previous output in the same line, it is commonly used in progress bars and animations.

Post a Comment

0Comments
Post a Comment (0)