Re: Another question about multidimentional arrays
- From: Victor Bazarov <v.Abazarov@xxxxxxxxxxxx>
- Date: Tue, 03 Jun 2008 10:56:15 -0400
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
.
- Follow-Ups:
- Re: Another question about multidimentional arrays
- From: Ron Francis
- Re: Another question about multidimentional arrays
- References:
- Another question about multidimentional arrays
- From: Ron Francis
- Another question about multidimentional arrays
- Prev by Date: Another question about multidimentional arrays
- Next by Date: Re: Another question about multidimentional arrays
- Previous by thread: Another question about multidimentional arrays
- Next by thread: Re: Another question about multidimentional arrays
- Index(es):
Relevant Pages
|