Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7079725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:42:26+00:00 2026-05-28T06:42:26+00:00

I can visualize the situation when, for example, I have allocated memory in the

  • 0

I can visualize the situation when, for example, I have allocated memory in the following way:

Position* arr1 = new Position[5];

Position being a class in my program that describes a positional point with x and y values.

There would be a pointer on the stack that points to the first element (a Position object) of the array “arr1” on the heap so it would look something like this:

enter image description here

How would it look if I were to create an array of pointers though? For example:

Position** arr2 = new Position* [2];

arr[0] = new Position(3, 7); // Constructs a point with x and y values.
arr[1] = new Position(9,6);

Where are all the pointers and objects stored in the memory in my second example? Are there pointers on the stack that point to pointers on the heap which then point to the objects on the heap or something?

Also, if I were to delete [] arr2;, where would the objects remain in the memory?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:42:27+00:00Added an answer on May 28, 2026 at 6:42 am

    You have one automatic variable, arr2 pointer object. The rest is on the free store. If you only delete[] arr2, you’ll free the memory for the pointers, and not the objects they point to.

    arr2 ---+  +---------------------------------+
            |  |                                 |
            |  |                                 |
            +----> [Position*, Position*]        |
               |       |          |              |
               |       |          +----> [9, 6]  |
               |       v                         |
               |    [3, 7]                       |
               +---------------------------------+
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I monitor or visualize memory fragmentation of a delphi application?
We have a giant big ass database and we can't visualize it. Is there
Instruments can visualize retain cycles under ARC in a graphically interesting way. I also
For about a year I have been thinking about writing a program that writes
I am a visual person, if I can visualize something it often makes more
I have the following data: User System SubSystem user1 System1 SubSystem1 user2 System1 SubSystem2
I am learning about OO design, and want to mentally visualize how can I
I have a form that can be filled, saved, loaded and re-edited. When it
I have a situation where I need to add an arbitrary unique id to
Here is the situation we have: a) I have an Access database / application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.