Exforsys

Online Training

Problem with Deleting

This is a discussion on Problem with Deleting within the C and C++ forums, part of the Programming Talk category; In C++ we have delete to delete objects once the object is finished using. I want to delete an array ...


Go Back   Exforsys > Programming Talk > C and C++

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-10-2007, 04:02 PM
Senior Member
 
Join Date: Apr 2006
Posts: 122
rachelle is on a distinguished road
Question Problem with Deleting

In C++ we have delete to delete objects once the object is finished using. I want to delete an array of objects given below
char *e = new char[50];

For doing this when I gave delete I got error message from compiler. Why is it so? Can’t I use delete to delete the above array of objects? Someone kindly troubleshoot this error.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-13-2007, 10:51 AM
Senior Member
 
Join Date: Apr 2006
Posts: 162
sammy is on a distinguished road
You have got the error in your program because you have made used to delete. But for deleting array of objects you have to use delete[]. Only for deleting an object we use delete but for deleting array of object one must make use of delete[].So replace delete with delete[] in your program and your program would execute successfully.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Artificial Intelligence FAQ:1/6 General Questions & Answers [Monthly posting] Ric Crabbe and Amit Dubey Tech FAQ 0 06-02-2004 01:12 AM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit Tech FAQ 0 06-01-2004 07:00 AM
Artificial Intelligence FAQ:1/6 General Questions & Answers [Monthly posting] Ric Crabbe and Amit Dubey Tech FAQ 0 05-05-2004 04:13 PM
PSION Series 3/3a palmtop FAQ part 3/6 Daniel `HB9VBC' Pfund Tech FAQ 0 04-17-2004 08:27 AM
Solving Lazy Initialization and double checked locking problem Vinay Aggarwal Software Patterns 19 02-18-2004 05:34 PM


All times are GMT -4. The time now is 12:26 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.