From: "Martin Ambuhl" 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 Precedence: bulk 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 */