Date: Tue, 10 Feb 1998 20:07:07 +0100 From: Hans-Bernhard Broeker Message-Id: <199802101907.UAA00439@acp3bf.physik.rwth-aachen.de> To: jalex AT ea DOT oac DOT uci DOT edu (Jason Alexander) Cc: djgpp AT delorie DOT com Subject: Re: Dynamically declaring 2-d arrays Newsgroups: comp.os.msdos.djgpp Organization: RWTH Aachen, III. physikalisches Institut B Precedence: bulk In article <34DF9744 DOT C7CFDBFE AT ea DOT oac DOT uci DOT edu> you wrote: > Can someone explain to me how to dynamically declare a 2-d array? [Yes, this is slightly off-topic, but as the thread has already started to grow, I'll just add my DM 0,02] In addition to the explanations given by others, let me describe a method that allows both kinds of access: explicit computation of an address and the [][] notation. Let's allocate a dynamical 'char a[n][m];': char *a_inner = malloc(n*m*sizeof(char)); char ** a = malloc(n*sizeof(char *)); int i; for (i=0; i