Some questions about strings
Denis
noreply at noserver.lan
Mon Jun 22 13:36:03 UTC 2020
On Monday, 22 June 2020 at 09:06:35 UTC, Jacob Carlborg wrote:
> String **literals** have a terminating null character, to help
> with integrating with C functions. But this null character will
> disappear when manipulating strings.
>
> You cannot assume that a function parameter of type `string`
> will have a terminating null character, but calling `printf`
> with a string literal is fine:
>
> printf("foobar\n"); // this will work since string literals
> have have a terminating null character
OK, it makes sense that the null terminator would be added where
compatability with C is required.
Good to know.
More information about the Digitalmars-d-learn
mailing list