C Programming - Strings - Discussion

Discussion Forum : Strings - General Questions (Q.No. 3)
3.
How will you print \n on the screen?
printf("\n");
echo "\\n";
printf('\n');
printf("\\n");
Answer: Option
Explanation:

The statement printf("\\n"); prints '\n' on the screen.

Discussion:
23 comments Page 2 of 3.

Apshana said:   1 decade ago
Why \ is used before \n?

Datta said:   10 years ago
Please explain me that?

Venkatesh said:   9 years ago
\ is escape sequence escape after letter while compilation.

Anuja said:   9 years ago
\n changes the line. But we wanna print \n so we have to take one "\".

Pradeepa said:   9 years ago
This was really a good concept & useful discussion, Thank you friends.

123 said:   9 years ago
Please explain the concept with an example.

Vavilapalli sateesh said:   8 years ago
"\\n "means it gives the output to the user whereas in "\n"gives white space and leave some lines.
(1)

Jayasai said:   8 years ago
If we put "ffn" in printf it showing output as ffn. But in question, they asked to print "fn".

Saroj kumari said:   8 years ago
Really, good concept.

Sangami said:   7 years ago
'\n' is the backslash character constant. specifically, it is an escape sequence. Thus to print backslash character itself put backslash (\) before that character.


Post your comments here:

Your comments will be displayed after verification.