tags:

views:

218

answers:

7

how to make the c compiler print \n

+14  A: 

Assuming you mean the pair of characters, \n, as opposed to a newline character:

printf("\\n");
Marcelo Cantos
thanx friends ... all answers correct
subanki
+9  A: 

printf("\\n"); Escape sequence \\ represents \

Prasoon Saurav
Why a downvote?
Prasoon Saurav
this place works like this :-) +1 for citing "escape sequence" the user should be aware of.
ShinTakezou
+3  A: 

How about

#error "\\n"
Roddy
+5  A: 

Depends what you need.

Either:

printf("\\n"); /* prints \n */

or:

printf("\n");  /* prints newline */
Igor Oks
+3  A: 

You can use \\n to print \n

printf( "\\n"  );

\n

Andrew-Dufresne
A: 
putchar('\\');
putchar('n');
ptomato
still the user needs to know about escaping sequence... +1 because of alternative to printf.
ShinTakezou
It was a joke...
ptomato
A: 

You can use escape char "\" printf("\n")

Sscheme