Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Strings are a fundamental concept in software engineering, but they are not a built-in type in C. Null-terminated byte strings (NTBS) consist of a contiguous sequence of characters terminated by and including the first NULL character , and are supported in C as the format used for string literals. The C programming language supports single-byte character strings, multibyte character strings, and wide character strings. Single-byte and multibyte character strings are both described as NULL-terminated byte strings, which are also referred to as "narrow character strings.".

A pointer to a NULLnull-terminated byte string points to its initial character. The length of the string is the number of bytes preceding the NULL character, and the value of the string is the sequence of the values of the contained characters, in order.

...

Null-terminated byte strings are implemented as arrays of characters and are susceptible to the same problems as arrays. As a result, rules and recommendations for arrays should also be applied to NULLnull-terminated byte strings.

...