The newline character is a single (typically 8-bit) character. It's represented in program source (either in a character literal or in a string literal) by the two-character sequence \n
.
So '\n'
is a character constant representing a single character, the newline character.
On the other hand (as Paul Griffiths' answer points out), "\n"
(with double quotes rather than single quotes) is a string literal that represents a string value. That string consists of two characters, a single '\n'
newline character and a '\0'
null character that marks the end of the string.