www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/04/25/07:15:13

From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Dynamically Allocated Arrays in C
Date: 25 Apr 2001 11:08:59 GMT
Organization: Aachen University of Technology (RWTH)
Lines: 16
Message-ID: <9c6b8b$3dd$1@nets3.rz.RWTH-Aachen.DE>
References: <iaxF6.15340$ff DOT 107947 AT news-server DOT bigpond DOT net DOT au>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 988196939 3501 137.226.32.75 (25 Apr 2001 11:08:59 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 25 Apr 2001 11:08:59 GMT
Originator: broeker@
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Ren <waxweazle69 AT yahoo DOT com> wrote:
> I have a slight problem with implementing a dynamically allocated 2D array.
> I was originally using 10 declerations of arrays in the following form:
> char claimsTagArray[40][9]; but it seemed a slight waste of memory and time.

> So i wanted to implement it dynamically so i only need to allocate memory to
> it when i need it.
[...]

As this is a generic C question, it's not a big surprise that the C
FAQ (posted regularly to comp.lang.c, among other places) has the
answer for it --- and it even manages to get away with only two
malloc() calls, instead of (1+firstDim) ones.  Go figure.
-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019