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.

Srilakshmi said:   1 decade ago
By using printf("\n"); we get blankscreen as \n is a white space character but printf("\\n"); gives output as \n

Vinod said:   1 decade ago
This is verbatim string. Putting any special character after "\" sign ignoresthe next character for compilation.

Shashank said:   1 decade ago
Give me specific reason about this answer. Why there is "\\" is used ?


Post your comments here:

Your comments will be displayed after verification.