What does '\r' and '\b' mean? Please explain with example.
Answers were Sorted based on User's Feedback
Answer / ankita
\r is known as carriage return
e.g printf("ABC\rDE");
ABC.
then becoz of \r cursor comes back to the 1st char i.e here
A after that DE is there then finally it print
DEC with cursor on C.
\b is known as back literal
e.g. printf("ABC\bDE");
then ABC then finally ABDE will get printed.
| Is This Answer Correct ? | 63 Yes | 27 No |
Answer / brite
Even you are wrong Siva.
printf("ABC\rDE") will print DEC not DE.
| Is This Answer Correct ? | 32 Yes | 16 No |
Answer / siva
above two answers are wrong.
i tested the following is the correct answer
\r is known as carriage return
e.g printf("ABC\rDE");
DE will get printed.
\b is known as back literal
e.g. printf("ABC\bDE");
ABDE will get printed.
| Is This Answer Correct ? | 31 Yes | 21 No |
Answer / subh
Depends on terminal configuration
http://stackoverflow.com/questions/17236242/usage-of-b-and-r-in-c
| Is This Answer Correct ? | 1 Yes | 2 No |
Answer / mahboob ur rahman
System.out.print("mahboob\rkhan");
output:
mahboob
it will just priint mahboob
| Is This Answer Correct ? | 1 Yes | 13 No |
Answer / yogita
\r is used for carriage return and \b is used for computer
baep
| Is This Answer Correct ? | 18 Yes | 32 No |
Answer / v
printf("ABC\bDE");
It prints only "DE", because the printed ABC will be removed
by '\b'
| Is This Answer Correct ? | 11 Yes | 28 No |
Write a C++ program that asks the user to choose a number between 1 and 1000. Then, your program should be able to guess the number by asking the user no more than 10 yes/no questions. Use a while loop in your program
What does obj stand for?
Is vector a class in c++?
Should I learn c or c++ or c#?
What are the types of container classes?
Where must the declaration of a friend function appear?
Consider the following code fragment: int main(void) { int m = 4; mystery ( m ); mystery ( m ); printf("%d", m); return 0; } What is the output on the monitor if mystery is defined as follows ? void mystery (int m) { m = m+3; }
What are the sizes and ranges of the basic c++ data types?
How to declaring variables in c++?
How can virtual functions in c++ be implemented?
What happens when the extern "c" char func (char*,waste) executes?
Difference between Constructors and static constructors?