But it's not an analogy. It's the assembler that's produced. Check it out. C
is about bit's and bytes, not "strings" and Data.

 

Michael

 

  _____  

From: [email protected] [mailto:[email protected]] On Behalf Of
Paul Herring
Sent: Tuesday, May 12, 2009 12:42 AM
To: [email protected]
Subject: Re: [c-prog] Difference b/w pointer to pointer and 2D arrays

 






On Tue, May 12, 2009 at 5:34 AM, Michael Comperchio <mcmp...@gmail.
<mailto:mcmprch%40gmail.com> com> wrote:
> The compiler will generate access code that looks something like this for
> multidimensional array access:
>
> *(*(level1 + n) + n)...

Hardly. If you're after an analogy which is more likely to be
implemented, try the simpler (assuming base[x][y]):

*(base + x times width +y)

Which involves no redirection with arrays of pointers and only one
dereference, all in a flat memory structure.

-- 
PJH

http://shabbleland. <http://shabbleland.myminicity.com/com>
myminicity.com/com
http://www.chavgang <http://www.chavgangs.com/register.php?referer=9375>
s.com/register.php?referer=9375





[Non-text portions of this message have been removed]

Reply via email to