Rectangular arrays Vs. multidimensional arrays.

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
 
J

Jon Skeet

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.
 
P

Peter N Roth

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".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top