Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!radar!cadillac!vaughan From: vaughan@puma.cad.mcc.com (Paul Vaughan) Newsgroups: comp.lang.c++ Subject: Re: Beginner's Problem Ref:Deallocation of space Message-ID: Date: 21 Mar 91 21:21:29 GMT References: <1719@umvlsi.ecs.umass.edu> <1991Mar20.171024.22386@watson.ibm.com> Sender: news@cadillac.CAD.MCC.COM Organization: MCC CAD Program, Austin, Texas Lines: 27 In-reply-to: mittle@blinn.watson.ibm.com's message of 20 Mar 91 17:10:24 GMT > I have created an array > int *pdata = new int[100] ; If what you want to do is to free the entire array, then you should use: delete pdata; Note that delete DOES NOT set the pointer to 0!! If you want to free only part of the array, I don't know if it is possible. Anyone know? No, it is not possible to delete only part of the array. In general, any memory that is allocated as a block must be deallocated as a block. For instance, you don't want to delete individual members of an object either. I believe whether delete sets the pointer to 0 is implementation dependent, but I don't have the ARM quote handy. -- Paul Vaughan, MCC CAD Program | ARPA: vaughan@mcc.com | Phone: [512] 338-3639 Box 200195, Austin, TX 78720 | UUCP: ...!cs.utexas.edu!milano!cadillac!vaughan ---------------------------------------------------------------------------------- I spent from $3 to $10 today to pay interest on the national debt. How about you? ----------------------------------------------------------------------------------