X-Authentication-Warning: niemeyer.net: Host 200.230.186.179-as.acessonet.com.br [200.230.186.179] claimed to be computer From: "Gustavo Niemeyer" To: Subject: RE: Dinamic allocation Date: Sat, 19 Jun 1999 14:55:38 -0300 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 In-Reply-To: <376AF383.E98318C6@t-online.de> Importance: Normal Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Thank you for your answer Antonio! I had to change some thing in your code to compile it. Code now looks like this: char **spans; spans = (char **) malloc(MAXHEIGHT); for(i=0; i > Hi there! > > I think I'm doing some thing wrong here. > > When I try to hard code an array like this: > > char spans[MAXHEIGHT][MAXWIDTH]; > > So the program runs ok. But when I try to > use dinamic memory allocation like this: > > char **spans; > spans = (char **) malloc(MAXWIDTH*MAXHEIGHT*sizeof(char)); > > When I run the program it prints a General > protection fault error, pointing to a loop > that accesses the array. > > Probably is something I'm missing... isn't it? > > Thank you > > Gustavo Niemeyer