|
From: Jason H. <jas...@nt...> - 2002-06-09 22:12:35
|
You should check that "EleTopo" is non-null before using it, just in case the memory allocation failed. I can't remember if the current MinGW used with Dev-C++ is standards compliant enought to throw an exception when memory allocation fails. You need to be sure that you aren't trying to access beyond the bounds of your array also, or alternatively invalidating either the memory or the pointer at some point and then trying to reuse it. Jason. ----- Original Message ----- From: "Ioannis Vranos" <no...@ho...> To: "Dev-C++ Mailing List" <dev...@li...> Sent: Sunday, June 09, 2002 7:06 PM Subject: RE: [Dev-C++] memory violation.... > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Raghunath Marella.S > Sent: Sunday, June 09, 2002 12:42 PM > To: dev...@li... > Subject: [Dev-C++] memory violation.... > > > Hi, > > I have been facing a simple but strange problem in my > C++ code. I have declared an integer pointer and whose > size has been fixed at a large value dynamically. > Like... > > seneles = 1000,ncn = 6; You forgot the type, e.g. int. > int *EleTopo = new int[seneles*ncn]; > > Once this block is filled with valid data, once those > values are printed and observed they seem to be > correct. But in between of the code, retrieving the > same had returned some junk values for some of the > indexes. Obviously you are doing something wrong. We must see the code. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net * Alternative URL: http://run.to/noicys _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink _______________________________________________ Dev-cpp-users mailing list Dev...@li... https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |