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 3 of 3.

Komal more said:   7 years ago
Why there is "\\" used?

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.

Praveen Negalurmath said:   5 years ago
If u put printf("\\n");

It could have printed \, why does it prints \n? Anyone explain.
(3)


Post your comments here:

Your comments will be displayed after verification.