www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Error on website.

reply "Saaa" <empty needmail.com> writes:
char[] str;
char[] str1 = "abc";
str[0] = 'b';        // error, "abc" is read only, may crash

Editing str has nothing to do with str1, as far as I know.
Feb 06 2008
parent reply Jesse Phillips <jessekphillips gmail.com> writes:
On Wed, 06 Feb 2008 21:23:06 +0100, Saaa wrote:

 char[] str;
 char[] str1 = "abc";
 str[0] = 'b';        // error, "abc" is read only, may crash
 
 Editing str has nothing to do with str1, as far as I know.

True, but it fails because str points to nothing.
Feb 06 2008
parent "Saaa" <empty needmail.com> writes:
 char[] str;
 char[] str1 = "abc";
 str[0] = 'b';        // error, "abc" is read only, may crash

 Editing str has nothing to do with str1, as far as I know.

True, but it fails because str points to nothing.

Feb 07 2008