delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/23/00:46:19

From: "Martin Ambuhl" <mambuhl AT tiac DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Program Crashes!!! Please help! Memory errors!!!
Date: Tue, 23 Jun 1998 00:39:06 -0400
Organization: Nocturnal Aviation
Lines: 28
Message-ID: <6mnbef$evp@news-central.tiac.net>
References: <358e8ecb DOT 0 AT news2 DOT ibm DOT net>
NNTP-Posting-Host: p37.tc1.newyo.ny.tiac.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Sal wrote in message <358e8ecb DOT 0 AT news2 DOT ibm DOT net>...
:OK....  I wrote this little program to sort a set of names and corresponding
:numbers.  It compiles fine... but when I run it it crashes.  It usually
:crashes in the middle of the data inpput part.  It tells me "Exiting due to
:signal SIGSEGV       General Protection Fault at eip=000058dc ........".
========
You have a typical newbie error:


:void main ()    /* djgpp will change this to int for you, but don't make it
                             do so.  declare main legally in the first place.
*/
:{
: int num;
: getnum (num);

: string datast[num-1];    // These two arrays have indices of
: int data[num-1];            //  0..num-2 (num-1 elements)
    // replace these with
string datast[num];        // Now they have indices of
int data[num];                // 0..num-1 (num elements)

Martin Ambuhl (mambuhl AT tiac DOT net)
/* Newsgroup posts also e-mailed */



- Raw text -


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