D - Braindead re: row-wise & column-wise
- Benji Smith (18/18) Aug 29 2003 I'm getting the semantics of multidimensional arrays all messed up in my...
- Walter (5/16) Aug 29 2003 mind,
I'm getting the semantics of multidimensional arrays all messed up in my mind,
and I need someone to help clarify something for me.
When declaring an array of strings, you're e3ssentially declaring a
multi-dimensional array. But I always get my row-wise and my column-wise array
accessing messed up. So, if I declare an array like this...
char[][] strings = ["zero", "one", "two", "three"];
..and I want to get the "one" entry into a new string, which of these do I
use...
char[] x = strings[][1];
char[] x = strings[1][];
char[] x = strings[1];
I've been writing code exclusively in perl lately (a requirement for work (btw,
I HATE perl's variable prefixes, using $ to dereference scalars from and %
structures, not to mention the {} required to dereference a hash value)), and
I'm having trouble remembering whether perl uses the same accessing order
(row-wise? column-wise?) as Java or C. It's like somebody whacked me in the head
with a stupid-stick.
--Benji Smith
Aug 29 2003
"Benji Smith" <dlanguage xxagg.com> wrote in message news:binldj$1uka$1 digitaldaemon.com...I'm getting the semantics of multidimensional arrays all messed up in mymind,and I need someone to help clarify something for me. When declaring an array of strings, you're e3ssentially declaring a multi-dimensional array. But I always get my row-wise and my column-wisearrayaccessing messed up. So, if I declare an array like this... char[][] strings = ["zero", "one", "two", "three"]; ..and I want to get the "one" entry into a new string, which of these do I use... char[] x = strings[][1]; char[] x = strings[1][]; char[] x = strings[1];The 3rd one.
Aug 29 2003








"Walter" <walter digitalmars.com>