Date: Thu, 17 Feb 2000 23:08:46 +0500 (MVT) From: Prashant TR X-Sender: prashant_tr AT midpec DOT com To: Kalum Somaratna aka Grendel cc: djgpp AT Delorie DOT com Subject: Re: Global variables and structs? In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: dj-admin AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Thu, 17 Feb 2000, Kalum Somaratna aka Grendel wrote: > This is true but the calculated use of global variables can help to avoid > passing many arguments to functions. So using global variables can help to > simplify the code and also make it easier to understand. But IMHO this > should be done if you are confident with C/C++. Doesn't help most of the times, but creates a nuisance instead. It's a bad practice to do this. Things like this can be used only for a single program, certainly not for a large project. > > Do it with structs. Then you can pass a pointer to the struct and to > > the screen and be done with it. > > Or better still use a global struct. That way you won't have to pass > anything at all and it will make writing the code easier. Don't think this is a good idea. What Damian has said would get you a better program. If the array is too large, consider using malloc.