From: Chris Jones Newsgroups: comp.os.msdos.djgpp Subject: Re: SIGSEGV problem with DJGPP (deleting array) Date: Wed, 14 Apr 1999 01:35:57 GMT Organization: Deja News - The Leader in Internet Discussion Lines: 29 Message-ID: <7f0rdt$3vn$1@nnrp1.dejanews.com> References: <7f0g7a$qg7$1 AT nnrp1 DOT dejanews DOT com> <199904132318 DOT TAA05382 AT envy DOT delorie DOT com> NNTP-Posting-Host: 128.40.205.1 X-Article-Creation-Date: Wed Apr 14 01:35:57 1999 GMT X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows 95) X-Http-Proxy: 1.1 x7.dejanews.com:80 (Squid/1.1.22) for client 128.40.205.1 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com In article <199904132318 DOT TAA05382 AT envy DOT delorie DOT com>, djgpp AT delorie DOT com wrote: > > > double *ptr2= new double [size+1]; > > ... > > delete [] ptr; > > I hope you meant ptr2 here. > > > double *ptr=new double [size]; > > ... > > delete [] ptr2; > > I hope you meant ptr here. I don't think so (or at least I hope not). The idea is to increase the size of the array ptr by one, so I copy to a dummy array, delete ptr and recreate it with a new, larger size. Then copy the old contents across from the dummy array and delete it. I am quite new to this however :) -- Chris Jones "Everybody who believes in psychokinesis, raise my right hand" -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own