X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f From: pete Newsgroups: comp.lang.c,comp.os.msdos.djgpp Subject: Re: Pointer Blues Date: Mon, 21 Jan 2002 09:51:00 -0500 Organization: PF Lines: 26 Message-ID: <3C4C2AD4.7344@mindspring.com> References: <3C4C2580 DOT 6F2C AT mindspring DOT com> NNTP-Posting-Host: 3f.35.7c.59 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Server-Date: 21 Jan 2002 14:52:21 GMT X-Mailer: Mozilla 3.04Gold (Win95; I) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com pete wrote: > int **initarray(int columns, int rows) > { > int x, **arr; > arr = malloc(columns * sizeof(int*)); > arr[x] = malloc(rows * sizeof(int)); arr = malloc(columns * sizeof *arr); and arr[x] = malloc(rows * sizeof *arr[x]); are slightly more better ways of writing those lines. since then all you would have to do, to change the function from initializing a 2 dimensional array of int, to initializing a 2 dimensional array of anything, doubles for example, would be to change: int x, **arr; to int x; double **arr; -- pete