[TUHS] Why is \n 012?

Greg Haerr greg at censoft.com
Sun Mar 9 13:57:31 AEST 2003


> A thing that has puzzled me almost for ever is why the newline
> character in C is 012 and not 015.  Does anybody have any insight?

Well, my take on this is that C was developed with UNIX,
of course, and UNIX early on decided to use a single
character rather than a two-char (CRLF) sequence for
end-of-lines.  So, since the CR was already in use for 
the leading char in the two-char sequence, it made it a lot
easier to use the LF character for the single newline, so
programs wouldn't always have to be checking a second
character...

Regards,

Greg




More information about the TUHS mailing list