Re: Another question about multidimentional arrays
- From: "Ron Francis" <ronfrancis@xxxxxxxxxxx>
- Date: Wed, 4 Jun 2008 00:48:00 +0930
"Victor Bazarov" <v.Abazarov@xxxxxxxxxxxx> wrote in message
news:g23m2g$nkl$1@xxxxxxxxxxxxxxxxxx
Ron Francis wrote:
I have wondered what the benefit is to using multidimensional arrays.
They represent the abstractions in your model correctly.
Isn't
int arr[10][10];
basically the same as
int arr[100];
The type is different, but the contents (and the memory they occupy) are
essentially the same.
Is the only benefit in how you visual the array in your mind in columns
and rows?
Mmm... It's all in the algorithms you use.
Is there any speed gain in using a single dimensional array?
No, and it's usually a rather huge loss when it comes to code clarity and
maintainability. The point of having the two dimensions is that your
algorithms are so much clearer when you allow the compiler to do the
actual resolving of the indices.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Thanks Victor,
I must be a linear type of guy because I haven't had much use for them.
When I first learned about them I remember thinking that the syntax for
passing and deleting (from distant memory) was awkward.
While I'm here, I want to say that I read a lot of replies from you and
Ulrich and just want to say thanks for your generosity.
All the best.
Regards,
Ron Francis
www.RonaldFrancis.com
.
- Follow-Ups:
- Re: Another question about multidimentional arrays
- From: Victor Bazarov
- Re: Another question about multidimentional arrays
- References:
- Another question about multidimentional arrays
- From: Ron Francis
- Re: Another question about multidimentional arrays
- From: Victor Bazarov
- Another question about multidimentional arrays
- Prev by Date: Re: Another question about multidimentional arrays
- Next by Date: Re: Passing address of multidimentional array
- Previous by thread: Re: Another question about multidimentional arrays
- Next by thread: Re: Another question about multidimentional arrays
- Index(es):
Relevant Pages
|