The line feed (LF) has an ASCII code number 10. Is '\n'
implemented as something MORE than a simple non-printable ASCII character?
Are there any C language specific details?
The line feed (LF) has an ASCII code number 10. Is '\n'
implemented as something MORE than a simple non-printable ASCII character?
Are there any C language specific details?
The character constant '\n'
represents what the C standard calls the "newline" character.
The standard doesn't say what the value of that character is. It happens to be 10 (LF
) on systems that use an ASCII-based character set (that includes Unicode) -- but the C standard doesn't require ASCII. (Starting with the 1999 standard, implementations may indicate that they support Unicode by predefining __STDC_ISO_10646__
, but that's optional.)
IBM mainframe systems, for example, use a different and incompatible character set called EBCDIC. On such systems, '\n'
will have a value other than 10.
Incidentally, (The question was updated to correct this.)'\10'
has the value 8, not 10. That syntax uses octal (base 8), not decimal. Character 10 is represented as '\12'
(or as '\xa'
in hexadecimal).