+1 vote
4,158 views
What is the use of this '\r' command, just give a small example.
Category
edited Oct 25, 2015 | 4,158 views
Is there something like R programming, please explain what it is.
dear prathibha also edit your question with language i.e C program,so that other users can get clear idea about question.or else you can add a tag C....Yes R is a programming language and software environment for statistical computing and graphics..

hai,

\r -carriage return

Moves the active position to the initial position of the current line...

For example

Original line- Gypsii\rgu

Result line -gupsii

In above example,after \r (carriage retrun) the cursor moves to the initial position..so the first 2 characters Gy  replaced by gu..

Thanks&Regards,

Gypsii....

dear gypsii ,prathibha has asked what is /r ? you have answered what is \r ? :) also prathibha has not given language the command used in is c or any other language ....
good explanation but OP has not specified language ! also asking for \r as @slow_learned commented
Thanks Prakash sir, by mistake I used as /r instead of \r.
It is \r only not /r, sorry I used it by mistake.  Is \r used only in C or is it used in any other languages also.
downvote -1 ,gypsii correct your output ..
Actual output will be :
Gypsii
gu

https://ideone.com/kK4Mt2
Please tell me one thing is it '/r' or'\r', I'm really confused.
please check that link and try changing the slash if you are in doubt :)..you will get clear idea..also edit your question with correct slash.....https://ideone.com/kK4Mt2
It's clear now, I was asked in an interview question about this carriage return, thats the reason that I wanted to know about it..now am clear. Thank you.
thank you gypsii for your contribution to the answer ..i have edited my answer and also removed my -1 :)
Tanq slow learner...

In C programming they denote the start of line usually we use \n (new line) , \r (Carriage Return Character) for start of line which is still used in mac os.

In case of one online compiler we have :

#include <stdio.h>

int main(void) {

printf("hai \r hello");
return 0;
}

Output :

hai
hello


It took output as new line for \r

But at the same time in c programming console application we have carriage return as moving to start of line :

The cursor moves to the initial position and replaces the characters gu with 2 in front Gy

edited Jun 3, 2016
"hailo" is the output that I get on running the above program, please clarify my doubt.
please let me know the compiler name..this link  : https://ideone.com/kK4Mt2 shows the output in C programming..kindly paste your code in question or give a try in any online compilers
Thank you I tried using the online compiler, but why there is difference between online and offline compilers?
some commands are platform dependent it seems :)
Ok thanks a lot!!!!!
#include <stdio.h>