Delete a new array?

Posted on 2004-10-31
Last Modified: 2010-03-31
Hi Experts,

I used "new" to create array:
     double[][] myArray;
     int n;
     n = 3;
     myArray = new double[n][n];
Do I need to delete the array like that in C++? If I need, how to do that?

Thank you in advance.
Question by:daveask
    LVL 16

    Accepted Solution

    When the array object is no longer pointed to by any other object, then it will be garbage collected.
    LVL 86

    Expert Comment

    krakatoa is correct

    Author Comment

    Thank you.

    So, Java is better than C++ and VB in this aspect :-)
    LVL 86

    Expert Comment

    >>So, Java is better than C++

    It has virtually automatic memory-management - there are no deletes, destructors, etc. I can't remember what VB does
    LVL 16

    Expert Comment

    Thanks for points and thanks CEHJ. ;)


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    Title # Comments Views Activity
    map interface methods 3 36
    MaxSpan challenge 9 36
    Problem to setup 18 55
    noX challenge 17 38
    After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
    This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
    Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
    This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

    845 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    5 Experts available now in Live!

    Get 1:1 Help Now