Sender: nate AT cartsys DOT com Message-ID: <36099AD4.3D967D66@cartsys.com> Date: Wed, 23 Sep 1998 18:05:24 -0700 From: Nate Eldredge MIME-Version: 1.0 To: Johan Henriksson CC: DJGPP mailinglist Subject: Re: Dynamic vs. Static arrays References: <199809232108 DOT XAA23784 AT d1o22 DOT telia DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk Johan Henriksson wrote: > > Johan Henriksson #12035895 > Pri: johan DOT henriksson AT borlange DOT mail DOT telia DOT com > Sec: jhe75 AT hotmail DOT com > HTTP://come.to/jhewok > > I started my work on JHeCL, another com. library. I assume you know of the existing libraries and are intentionally reinventing the wheel? Okay. > I want to optimize the > FIFO so here's the question: Is it faster to access a static array than > accessing a dynamic one. In general, the same. Memory is memory. There could be issues with the cache but they are very unpredictable and it's very hard to say which would be preferable. IMHO, don't worry about it. >And how do I create a 1Dim Dyn. array under DJGPP? Static version: int x[300]; Dynamic: int *x; x = malloc(300 * sizeof(int)); /* replace 300 with appropriate value */ Consider a C textbook; memory allocation in C is very important to understand well. -- Nate Eldredge nate AT cartsys DOT com