3d array: what does this notation mean?

  • Thread starter Thread starter Frank
  • Start date Start date
F

Frank

C#: cubearray??

int[ , , ] cubeArray = {{{7, 2}, {1, 4}}, {{3, 5}, {4, 4}}};

How do I interpret the above array statement?

regards,
Frank
 
cubeArray[1,1,1] = 7
cubeArray[1,1,2] = 2
cubeArray[1,2,1] = 1
cubeArray[1,2,2] = 4
cubeArray[2,1,1] = 3
cubeArray[2,1,2] = 5
cubeArray[2,2,1] = 4
cubeArray[2,2,2] = 4

Robby
VB.Net
 
Arrays are 0-based in C#, so 1 must
be subtracted from every index as written.
First is therefore cubeArray[0,0,0] = 7;
--
Grace + Peace,
Peter N Roth
Engineering Objects International
http://engineeringobjects.com
Home of Matrix.NET


Robby said:
cubeArray[1,1,1] = 7
cubeArray[1,1,2] = 2
cubeArray[1,2,1] = 1
cubeArray[1,2,2] = 4
cubeArray[2,1,1] = 3
cubeArray[2,1,2] = 5
cubeArray[2,2,1] = 4
cubeArray[2,2,2] = 4

Robby
VB.Net


Frank said:
C#: cubearray??

int[ , , ] cubeArray = {{{7, 2}, {1, 4}}, {{3, 5}, {4, 4}}};

How do I interpret the above array statement?

regards,
Frank
 
opps .. You are soo right. They are 0 based in VB.Net also. I don't know
what I was thinking. I must have reverted to my VB6 days.

Robby

Peter N Roth said:
Arrays are 0-based in C#, so 1 must
be subtracted from every index as written.
First is therefore cubeArray[0,0,0] = 7;
--
Grace + Peace,
Peter N Roth
Engineering Objects International
http://engineeringobjects.com
Home of Matrix.NET


Robby said:
cubeArray[1,1,1] = 7
cubeArray[1,1,2] = 2
cubeArray[1,2,1] = 1
cubeArray[1,2,2] = 4
cubeArray[2,1,1] = 3
cubeArray[2,1,2] = 5
cubeArray[2,2,1] = 4
cubeArray[2,2,2] = 4

Robby
VB.Net


Frank said:
C#: cubearray??

int[ , , ] cubeArray = {{{7, 2}, {1, 4}}, {{3, 5}, {4, 4}}};

How do I interpret the above array statement?

regards,
Frank
 
Back
Top