A null character is one that carries no value and has all its bits set to 0. It is available in most major programming languages and many major character sets, including ASCII and Unicode. It is sometimes abbreviated as NUL or referred to as a null byte.
How are null characters used?
Null characters have several use cases. In early computer technology, blank rolls of punched paper tape were considered to consist entirely of null characters that would eventually be replaced once new characters were punched. In database, spreadsheet, and word processor applications, null characters are often displayed as spaces to create padding.
In the C programming language and its derivatives, a null character is represented by . This escape sequence marks the end of a character string. In C++, some examples might look like this:
This sentence will stop after “the” as noted by the null character placement:
cout << “I will not finish the sentence.”;
This sentence stops at its natural end because the null character falls after the period:
cout << “I will finish the sentence. ”;