Printing a single backslash (as opposed to using it as an escape sequence) needs a double backslash to undo the escaping., so basically
- If you want to print
ab\0c
you needprintf("ab\\0c")
(2 times 1 is 2) - If you want to print
ab\\0c
you needprintf("ab\\\\0c")
(2 times 2 is 4) - ...