Results 1 to 3 of 3

Thread: the delete and delete [ ] : C++

  1. #1
    Millerjames is offline Senior Member
    Join Date
    Dec 2009
    Posts
    331
    Rep Power
    3

    Default the delete and delete [ ] : C++

    I am last year commuter science student. I have little bit knowledge of C++ but I do not have the knowledge of the all of the operators. I want to know what is the difference between the delete operator and delete [] operator. I want to know about how can I am able to implement the delete and delete [] operator. Thus, if anybody is there who has knowledge of operator, reply me as soon as possible. Thanks in advanced.

  2. #2
    Davisricky is offline Senior Member
    Join Date
    Dec 2009
    Posts
    331
    Rep Power
    3

    Default

    In C++ language, whenever the object cannot be required any more, delete operator can be used to free the block of memory. It could be advantage for you to use the delete operator to free the get block of memory when the new operator can be utilized to get the assured block of memory for execution. It can be sufficient for you to learn the delete operator.

  3. #3
    Garcíarobine is offline Senior Member
    Join Date
    Dec 2009
    Posts
    334
    Rep Power
    3

    Default

    Try to understand given code which is helpful for you.

    Code:

    #include <iostream>
    #include <new>
    using namespace std;
    struct mc
    {
    mc()
    {
    cout <<"mc constructed\n";
    }
    ~mc()
    {
    cout <<"mc destroyed\n";
    }
    };
    int main ()
    {
    mc * rt;
    rt = new mc;
    delete rt;
    return 0;
    }

    Output:

    mc constructed

    mc destroyed

Similar Threads

  1. Can’t delete msnfo32.exe
    By TorresScott in forum General Internet Terms
    Replies: 2
    Last Post: 03-19-2010, 02:58 PM
  2. Can’t delete PWS-OnlineGames.hh
    By RogersNguyen in forum Gaming Accessories
    Replies: 2
    Last Post: 03-13-2010, 12:24 PM
  3. How to delete the Virus
    By MoralesMyers in forum Networking Jargons
    Replies: 2
    Last Post: 02-08-2010, 05:33 PM
  4. How to Delete the Password
    By CollinsBrown in forum Hardware Jargons
    Replies: 0
    Last Post: 12-24-2009, 02:39 PM
  5. Delete Key not working
    By arsenal in forum General Internet Terms
    Replies: 0
    Last Post: 01-29-2009, 10:54 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48