expected array behaviour

Mike James foo at bar.com
Thu Jan 1 14:55:16 PST 2009


I have a function that uses 2 array strings defined similar to this...

const char[] array1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char[]  array2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

If I make a change to a char in array1 it also changes the same in array2.
But if I define the arrays as follows...

const char[26] array1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char[26]  array2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

It doesn't occur. Is this expected behaviour?

Regards,
-=mike=-


More information about the Digitalmars-d-learn mailing list