C Programming - Strings - Discussion
Discussion Forum : Strings - General Questions (Q.No. 3)
3.
How will you print \n on the screen?
Answer: Option
Explanation:
The statement printf("\\n"); prints '\n' on the screen.
Discussion:
23 comments Page 1 of 3.
Praveen Negalurmath said:
5 years ago
If u put printf("\\n");
It could have printed \, why does it prints \n? Anyone explain.
It could have printed \, why does it prints \n? Anyone explain.
(3)
Priya said:
7 years ago
@Komal.
\\n is used for print\n
print("\\n")->it print \n
print("\\s")->it print \s
likewise it print.
\\n is used for print\n
print("\\n")->it print \n
print("\\s")->it print \s
likewise it print.
Komal more said:
7 years ago
Why there is "\\" used?
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.
Saroj kumari said:
8 years ago
Really, good concept.
Jayasai said:
8 years ago
If we put "ffn" in printf it showing output as ffn. But in question, they asked to print "fn".
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)
123 said:
9 years ago
Please explain the concept with an example.
Pradeepa said:
9 years ago
This was really a good concept & useful discussion, Thank you friends.
Anuja said:
9 years ago
\n changes the line. But we wanna print \n so we have to take one "\".
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers