delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/18/19:06:40

X-Authentication-Warning: niemeyer.net: Host 200.230.186.185-as.acessonet.com.br [200.230.186.185] claimed to be computer
From: "Gustavo Niemeyer" <djgpp AT niemeyer DOT net>
To: <djgpp AT delorie DOT com>
Subject: Dinamic allocation
Date: Fri, 18 Jun 1999 20:05:00 -0300
Message-ID: <LOBBKLEPLBKLOKFELHOIEELBCCAA.djgpp@niemeyer.net>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Reply-To: djgpp AT delorie DOT com

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

- Raw text -


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