null-terminated string

From SEGGER Wiki
Jump to: navigation, search

A NULL-terminated string is a sequence of characters that ends with a character of 0. This is the standard string in C. Example:

"Hello" is a 6 byte string, where the 5 visible characters are followed by a 0.
In memory, things look as follows: (Using hex representation)
48 65 6C 6C 6F 00

The null termination is expected by all string related routines in the C-standard library, such as strlen, strcpy.