Since the null character is not a
printable character, representing it requires special notation in
source code. In a
string literal, the null character is often represented as the
escape sequence \0 (for example, "abc\0def"). Similar notation is often used for a character literal (i.e. '\0') although that is often equivalent to the numeric literal for zero (0). In many languages (
such as C, which introduced this notation), this is not a separate escape sequence, but an octal escape sequence with a single
octal digit 0; as a consequence, \0 must not be followed by any of the digits 0 through 7 because in that case it will be interpreted as the start of a longer octal escape sequence. Other escape sequences that are found in use in various languages are \000, \x00, \z, or \u0000. A null character can be placed in a
URL with the
percent code %00. The ability to represent a null character does not always mean the resulting string will be correctly interpreted, as many programs will consider the null to be the end of the string. Thus, the ability to type it (in case of
unchecked user input) creates a
vulnerability known as
null byte injection and can lead to security exploits. In
software documentation, the null character is often represented with the text
NUL (or
NULL although that may mean the
null pointer). In
Unicode, there is a character for this: . In
caret notation the null character is ^@. On some keyboards, one can enter a null character by holding down and pressing (on US layouts just will often work, there being no need for to get the @ sign). == References ==