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 8691513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:08:09+00:00 2026-06-13T00:08:09+00:00

In these lines of C++ code: int * p = new int(33); delete(p); *p

  • 0

In these lines of C++ code:

int * p = new int(33);
delete(p);
*p = 13;
cout << *p << endl;

The output is 13;

P points to an address on the heap initially, then I use the delete keyword to deallocate p’s assigned memory address, but can still assign the memory address a value of 23; Is this the same address on the heap that p pointed to after “int * p = new int(33)” or does p point to an address on the stack after using delete(p)?

  • 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-06-13T00:08:10+00:00Added an answer on June 13, 2026 at 12:08 am

    Deleting p signals to whoever manages the memory (the OS) that the underlying space is now free to be re-allocated by someone else for their own use. p, however, still points to the same memory location and can be dereferenced to obtain the value of what’s in that memory — note that since that memory may now be used by someone else, the underlying bits might be different from what they were before.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have these lines of code in a command line project in VS2010 c++.
I wrote these lines in my code: CFUUIDRef identifier = CFUUIDCreate(NULL); NSString *identifierString =
So I have these lines of javascript code that I need to remove all
I grabbed this code form JCarousel and just trying to understand these lines below.
I find some code sample with these oddl lines QList<TDataXml *> *newXMLData = input->getValue<QList<TDataXml
The code below tries to parse a file containing these 3 lines: 0 2
I have these lines of code. I know you can not pass a non
Is there a way of calling a method/lines of code multiple times not using
Is there a common way of counting source lines of code (SLOC) in a
We have a 2,000,000 lines of code application in Mercurial. Obviously there is a

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.