www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - strings and array literal mutability

reply "Freddy" <Hexagonalstar64 gmail.com> writes:
Why are strings immutable but array literals are not?
Feb 24 2015
parent reply "Tobias Pankrath" <tobias pankrath.net> writes:
On Tuesday, 24 February 2015 at 22:12:57 UTC, Freddy wrote:
 Why are strings immutable but array literals are not?
Because string is an alias for immutable(char).
Feb 24 2015
parent =?UTF-8?B?QWxpIMOHZWhyZWxp?= <acehreli yahoo.com> writes:
On 02/24/2015 02:51 PM, Tobias Pankrath wrote:
 On Tuesday, 24 February 2015 at 22:12:57 UTC, Freddy wrote:
 Why are strings immutable but array literals are not?
Because string is an alias for immutable(char).
You meant immutable(char)[]. :) Ali
Feb 24 2015