C Programming - Control Instructions - Discussion

Discussion Forum : Control Instructions - True / False Questions (Q.No. 2)
2.
If scanf() is used to store a value in a char variable then along with the value a carriage return(\r) also gets stored it.
True
False
Answer: Option
Explanation:

No, the carriage return tells the compiler to read the input from the buffer after ENTER key is pressed.

Discussion:
10 comments Page 1 of 1.

Rishabh said:   9 years ago
First printf statement executes the abc when the second printf execute the first carriage return will place the cursor at the beginning of line then abc will be overridden with dec.

Muskaan said:   1 decade ago
Carriage return is '\r'.

It puts the cursor to the beginning of the line *while run time*.

Rishi said:   9 years ago
abc is override by the dec because \r return the cursor to beginning of the line.

Divya said:   1 decade ago
Ex:

printf("abc");
printf("\rde");

Then output is: dec.

Suraj said:   10 years ago
If it puts the cursor at the beginning of line then how output comes "dec"?

Srikanth said:   8 years ago
Anyone give any example program for the above question?

Ajay said:   1 decade ago
What is carriage return?can someone please explain.

Shital said:   9 years ago
Thanks. I totally understand about carriage return.

Prashant bhosale said:   5 years ago
What is the meaning of /r?

Suraj said:   10 years ago
Where is ab?

Post your comments here:

Your comments will be displayed after verification.