From: billlanam AT california DOT com (Bill Lanam) Newsgroups: comp.os.msdos.djgpp Subject: Re: Question about global arrays Date: Thu, 27 Feb 1997 21:08:12 GMT Message-ID: <3315f69e.7013153@seashell.california.com> References: <857066972 DOT 28853 AT dejanews DOT com> NNTP-Posting-Host: 140.174.210.137 Lines: 34 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp On Thu, 27 Feb 1997 12:21:19 -0600, stefansk AT evansville DOT edu wrote: > I have a question... It may be more of a C question than DJGPP, but >my professors don't seem to know what wrong... > > I've got a multi-file program. Because of how much I'll be using it, >I'm trying to declare an array as global. In the main section, I'm >declaring the array, and then I've got it declared as extern in a .h file >that I'm including in all the other sections. > > In one of my sections, I'm loading the array with values from a file. > I know this is working properly, since I've saved it right after loading >it in, and it's saved exactly as it's loaded in. > > The section where I'm using it is in a different .cpp file, and by >the time I get there, the values I've loaded in are lost. > > This is become a really sticky point. I've checked with two >professors here at UE, and neither of them can spot anything I'm doing >wrong... Help! > >-------------------==== Posted via Deja News ====----------------------- > http://www.dejanews.com/ Search, Read, Post to Usenet Without your code here are some possiblities. You are overwriting the array values prior to getting to your section. You are using a pointer with an incorrect value in it and end up overwriting your array . You are getting to your section before you load the array. Bill Lanam