Rectangular arrays Vs. multidimensional arrays.

  • Thread starter Thread starter Nikhil Patel
  • Start date Start date
N

Nikhil Patel

Hi all,
I am readin an MSDN tutorial on C# arrays. It says,

you can have a three-dimensional rectangular array:
int[,,] buttons = new int[4,5,3]; What I don't understand is how can a
three dimensional array be a rectangular array because a rectangle can have
only two dimensions.Thanks in advance...-Nikhil
 
Nikhil Patel said:
I am readin an MSDN tutorial on C# arrays. It says,

you can have a three-dimensional rectangular array:
int[,,] buttons = new int[4,5,3]; What I don't understand is how can a
three dimensional array be a rectangular array because a rectangle can have
only two dimensions.Thanks in advance...-Nikhil

It's really just a label for it - commonly they'll have two dimensions,
but there's no need for it to be like that. I guess a three-dimensional
rectangular array is really a cuboid array, and then it goes into
hyper-cuboid etc, but it's easiest just to keep calling them all
rectangular arrays.
 
Rectangular in this context means that
each dimension is a constant, rather
than specifying the length of each "row"
in what is known as a matrix with a
"ragged edge".
 
Back
Top