Date: Fri, 15 Jan 1999 14:32:17 +0100 (MET) From: Wojciech Piechowski To: djgpp AT delorie DOT com Subject: Re: Problems with Arrays In-Reply-To: <369E963C.ED7FB1DC@mailbox.uq.edu.au> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com On Fri, 15 Jan 1999, Konstanty wrote: > In a program of mine I have two arrays initilised with "new". > > eg > int *Map; > Map=new int [225]; > > The problem is that when I write to one array it corrupts the other with > the same data. > > Is this because they were not initilised properly? > If so how can you check if an array is initilised properly? It seems that you tried to access the data behind the limit of the first array: A = new int[10]; B = new int[10]; A[15] = 1; // this corrupts some data, possibly B's. ^^ You should also check if operator new didn't return NULL pointer. --------------------\ Wojciech Piechowski /---------------------------- Student informatyki \ voyt AT ds2 DOT pg DOT gda DOT pl / Student of computer science Politechnika Gdanska \________________/ Technical University of Gdansk