string literals

Milke Wey no.spam at example.com
Sun Jan 27 07:23:44 PST 2008


On Sat, 2008-01-26 at 15:26 -0500, bearophile wrote:
> Milke Wey:
> > On linux you would get an nice Segfault when running that code.
> 
> Ah, thank you then. I have thought that's true only for string literals assigned to static arrays:
> 
> void main() {
>     char[3] str = "abc";
>     str[0] = 'b';
> }
> 
> Bye,
> bearophile

I don't know why but it actually works when using a static array.

-- 
Mike Wey



More information about the Digitalmars-d-learn mailing list