control character whose bits are all 0

The null character is a control character with the value zero. Many character sets include a code point for a null character – including Unicode (Universal Coded Character Set), ASCII (ISO/IEC 646), … Wikipedia
🌐
Wikipedia
en.wikipedia.org › wiki › Null_character
Null character - Wikipedia
1 week ago - The null character is a control character with the value zero. Many character sets include a code point for a null character – including Unicode (Universal Coded Character Set), ASCII (ISO/IEC 646), Baudot, ITA2 codes, the C0 control code, and EBCDIC. In modern character sets, the null character ...
🌐
ASCII Code
ascii-code.com › character › ␀
Null character - ASCII Code
In some cases, it is referred to as the NUL character. Here are some key details: In ASCII and Unicode, the null character is defined to be U+0000, meaning it is represented in Unicode as the number 0.
Discussions

Null character '\0' & null terminated strings
should the strings be terminated by NUL in that character set, or by a character whose value is zero? The character '\0' is guaranteed to be a byte with all bits zero, and to have a numeric value equal to zero. A string in C always ends with this character. Then, according to Wikipedia, the null character is encoded as two bytes 0xC0, 0x80. No, in standard UTF-8 the code point with value zero is encoded in a single zero byte. You may have been reading something about "modified UTF-8", which appears to be a rather Java-centric external encoding for strings. It deliberately uses an "overlong" encoding of Java '\u0000' so that the resulting byte sequence does not contain a zero byte. One reason for this is because the length of strings in Java is not defined by use of a terminating character — a Java string can contain arbitrary '\u0000' characters — and you might need some way to round-trip such strings between Java and a language like C that does use a zero byte as a terminator. More on reddit.com
🌐 r/C_Programming
14
17
December 25, 2022
is 'NUL' a name or abreviation in ASCII? - Stack Overflow
to my understanding, in ASCII NUL is not a name, it's an abreviation. Is this correct? In wikipedia it says that the ASCII NULL character is called NUL. In comment 2962254, Matteo Italia states t... More on stackoverflow.com
🌐 stackoverflow.com
How to simulate NUL character from keyboard? - Stack Overflow
NULL is a (control) character, in Ascii, Unicode (U+0000), and other standards. More on stackoverflow.com
🌐 stackoverflow.com
Null consistency - libs - Rust Internals
We have ptr::null and ptr::is_null, but CStr::from_bytes_with_nul and "nul-terminated" strings. I think it would be more consistent to replace (deprecate and reëxport) all instances of nul with null. What do you all think? If we have rough consensus here, I'll prepare a PR for T-libs-api FCP. More on internals.rust-lang.org
🌐 internals.rust-lang.org
2
June 7, 2022
🌐
Reddit
reddit.com › r/c_programming › null character '\0' & null terminated strings
r/C_Programming on Reddit: Null character '\0' & null terminated strings
December 25, 2022 -

Hello everyone!
In C, strings (character arrays) are terminated by null character '\0' - character with value zero.
In ASCII, the NUL control code has value 0 (0x00). Now, if we were working in different character set (say the machine's character set wouldn't be ASCII but different one), should the strings be terminated by NUL in that character set, or by a character whose value is zero?

For example, if the machine's character set would be UTF-16, the in C, byte would be 16bits and strings would be terminated by \0 character with value 0x00 00, which is also NUL in UTF-16.
But, what if the machine's character set would be modified UTF-8 (or UTF-7, ...). Then, according to Wikipedia, the null character is encoded as two bytes 0xC0, 0x80. How would be strings terminated in that case? By the byte with value 0 or by the null character.

I guess my question could be rephrased as: Are null terminated strings terminated by the NUL character (which in that character set might be represented by a nonzero value) or by a character whose value is zero (which in that character set might not represent the NUL character).

Thank you all very much and I'm sorry for all mistakes and errors as english is not my first language.

Thanks again.

Top answer
1 of 3
31
should the strings be terminated by NUL in that character set, or by a character whose value is zero? The character '\0' is guaranteed to be a byte with all bits zero, and to have a numeric value equal to zero. A string in C always ends with this character. Then, according to Wikipedia, the null character is encoded as two bytes 0xC0, 0x80. No, in standard UTF-8 the code point with value zero is encoded in a single zero byte. You may have been reading something about "modified UTF-8", which appears to be a rather Java-centric external encoding for strings. It deliberately uses an "overlong" encoding of Java '\u0000' so that the resulting byte sequence does not contain a zero byte. One reason for this is because the length of strings in Java is not defined by use of a terminating character — a Java string can contain arbitrary '\u0000' characters — and you might need some way to round-trip such strings between Java and a language like C that does use a zero byte as a terminator.
2 of 3
17
C11 states: 5.2 Environmental considerations 5.2.1 Character sets 2. In a character constant or string literal, members of the execution character set shall be represented by corresponding members of the source character set or by escape sequences consisting of the backslash \ followed by one or more characters. A byte with all bits set to 0, called the null character, shall exist in the basic execution character set; it is used to terminate a character string. Emphasis is mine From that we can understand that the terminating null character is always completely 0. Then, there's: 5.2.1.2 Multibyte characters A byte with all bits zero shall be interpreted as a null character independent of shift state. Such a byte shall not occur as part of any other multibyte character. 7.1.1 Definitions of terms A string is a contiguous sequence of characters terminated by and including the first null character. The term multibyte string is sometimes used instead to emphasize special processing given to multibyte characters contained in the string or to avoid confusion with a wide string. A pointer to a string is a pointer to its initial (lowest addressed) character. The length of a string is the number of bytes preceding the null character and the value of a string is the sequence of the values of the contained characters, in order.
Find elsewhere
Top answer
1 of 2
3

"NUL" is short for "NULL". Quoting ECMA-48, which lists all control characters as "8.3.xx acr - name":

8.3.88 NUL - NULL
Notation: (C0)
Representation: 00/00

NUL is used for media-fill or time-fill. NUL characters may be inserted into, or removed from, a data stream without affecting the information content of that stream, but such action may affect the information layout and/or the control of equipment.

Now, about your question:

In wikipedia it says that the ASCII NULL character is called NUL.

This is not what Wikipedia says. It says the ASCII null (lowercase!) character is called NUL. "Null character" is a term that applies to all character encodings, "NULL character" is not.

Wikipedia is correct, as there is nothing wrong with referring to this character by its official acronym.

In comment 2962254, Matteo Italia states that the NULL character is not called NULL.

He is wrong about that.

here, the table in "Character groups", the name is "NULL", abreviated "NUL"
here NUL is an abreviation, not a name

These are both correct.

in answer 30121329: «NUL is the name given to the first ASCII character.»

This is technically incorrect, but for all practical purposes correct. The acronyms are better known than the official names, and I don't see much of a problem in treating those acronyms as names.

2 of 2
1

Yes, nul, is an abbreviation of null.

Not a particularly shortened version as it’s only shorter by one character, but as ASCII characters are limited to 3, so there isn’t much choice really.

The uppercase standard of NUL is a convention of ASCII, for example, TAB.

🌐
GeeksforGeeks
geeksforgeeks.org › c++ › g-fact-72
ASCII NULL, ASCII 0 ('0') and Numeric literal 0 - GeeksforGeeks
July 23, 2025 - The ASCII (American Standard Code for Information Interchange) NULL and zero are represented as 0x00 and 0x30 respectively. An ASCII NULL character serves as a sentinel character of strings in C/C++. When the programmer uses '0' in his code, ...
🌐
Quora
quora.com › What-is-a-null-character-NUL-on-a-system-level-and-how-can-we-use-it
What is a null character (NUL) on a system level, and how can we use it? - Quora
Answer: NUL is the ASCII character with a numeric value of zero. In C/C++ and close kin the nul character is used to mark the end of a string (rather than using the first byte or word of the “string” to encode the number of characters in ...
🌐
University of Texas
farside.ph.utexas.edu › teaching › 329 › lectures › node21.html
Character strings
Here, 'f' represents the character ``f'', etc., and '\0' represents the so-called null character (ASCII code 0), which is used in C to signal the termination of a character string. The null character is automatically added to the end of any character string enclosed in double quotes.
🌐
Codedamn
codedamn.com › news › c programming
What is \ 0 (null byte) in C? Explained with examples.
November 9, 2023 - In the C language, \0 represents the null character. Not to be mistaken for the digit '0', it's a character with an ASCII value of zero. When you see \0 in code, you're looking at a single character that represents the number 0 in the ASCII table.
🌐
OSDev Wiki
wiki.osdev.org › Null_Character
Null Character - OSDev Wiki
March 12, 2024 - From this point forward, when we mention the null character/terminator, we will refer to a 8-bit ASCII NULL character, represented as 0x00 in hexadecimal or, in C, as the escape sequence '\0' (not to confuse with "\0", which in C is a null-terminated string containing one null character).
🌐
Unicode Compart
compart.com › en › unicode › U+0000
U+0000 <Null> (NUL) Unicode Character
U+0000 is the unicode hex value of the character (NUL). Char U+0000, Encodings, HTML Entitys:,, UTF-8 (hex), UTF-16 (hex), UTF-32 (hex)
🌐
TechTerms
techterms.com › definition › nullcharacter
Null Character Definition - What is a null character?
September 30, 2022 - It is often used in computer ... used as filler spaces. In most character encoding sets, such as UTF-8 and ASCII, the null character is the first character in the set....
🌐
Rust Internals
internals.rust-lang.org › libs
Null consistency - libs - Rust Internals
June 7, 2022 - We have ptr::null and ptr::is_null, but CStr::from_bytes_with_nul and "nul-terminated" strings. I think it would be more consistent to replace (deprecate and reëxport) all instances of nul with null. What do you all th…