Null-terminated string: Difference between revisions

Content deleted Content added
Citation bot (talk | contribs)
Alter: title. Add: title, journal, s2cid, doi, pages. Changed bare reference to CS1/2. Removed parameters. Formatted dashes. Some additions/deletions were parameter name changes. | Use this bot. Report bugs. | Suggested by BrownHairedGirl | Linked from User:BrownHairedGirl/Articles_with_bare_links | #UCB_webform_linked 472/2195
ASCIIZ in intro, but ASCIZ is the only form used in main text
Line 1:
{{see also|String (computer science)#Null-terminated}}
{{Use dmy dates|date=August 2021}}
In [[computer programming]], a '''null-terminated string''' is a [[character string]] stored as an [[Array data structure|array]] containing the characters and terminated with a [[null character]] (a character with a value of zero, called NUL in this article). Alternative names are '''[[C string]]''', which refers to the [[C (programming language)|C programming language]] and '''ASCIIZ'''{{citation needed}} (although C can use encodings other than ASCII).
 
The length of a string is found by searching for the (first) NUL. This can be slow as it takes O(''n'') ([[linear time]]) with respect to the string length. It also means that a string cannot contain a NUL (there is a NUL in memory, but it is after the last character, not "in" the string).