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.

Raj said:   1 decade ago
\n -> takes the control to the newline if we give printf("\n").

So if we add one more \ it loses the newline property.

printf("\\n") -> it will print \n

printf("\\b") -> it prints \b

Sasi said:   1 decade ago
Never heard about "\\n" can anyone explain in detail?

Tina Jadhav said:   1 decade ago
Usually we use \n, never heard about"\\n". When we have to use this?


Post your comments here:

Your comments will be displayed after verification.