RE: [Dev-C++] delete statement gives segmentation fault error
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <iv...@em...> - 2003-08-16 06:43:07
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Dawood Vora > Sent: Friday, August 15, 2003 3:39 AM > To: Dev C++ > Subject: [Dev-C++] delete statement gives segmentation fault error > > > Hello every body, > below is a straight code from Stroustrup's classic. I > am running > bloodshed DEV-C++. At the end, it is trying to delete the > object "input" > using delete statement. It straightaway gives me invalid memory or > segmentation fault error. Also, if I comment the delete > statement, the > code works fine as it should be. Actually it happens, only > when I try to > pass the command line arguement. As u all know, it is the > famous calculator > example from the 6th chapter of the book. Right now, I am in the 6th > chapter, so I do not have a very good idea about new and delete > statements. According to me the code should work, as we are > trying to > delete the object we explicitly created. > > if (input != cin) delete input; if(input!=&cin) Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net |