Difference between revisions of "null-terminated string"
(Created page with "Category:Knowledge Base 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 by...") |
m |
||
Line 4: | Line 4: | ||
Example: |
Example: |
||
"Hello" is a 6 byte string, where the 5 visible characters are followed by a 0. |
"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) |
+ | In memory, things look as follows: (Using [[hex]] representation) |
48 65 6C 6C 6F 00 |
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. |
The null termination is expected by all string related routines in the C-standard library, such as strlen, strcpy. |
Latest revision as of 15:36, 7 July 2019
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.