\012 is an octal escaped character, not a NUL , followed by 1 and 2 . x terminates the second octal character, so it really is NUL . ( \x34 will be the correct form for the hexadecimal escaped character.)
Representing the NUL as \0 is just a special case of the octal escape sequence. In the general case, \ can be followed by one, two, or three octal digits to form a valid octal escape sequence in a character or string literal.
source share