Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I'm struggling with pointers. I CANT figure out how get Line 41 working and everything after that. Plus it gets even more confusing when deleting
I'm struggling with pointers. I CANT figure out how get Line 41 working and everything after that. Plus it gets even more confusing when deleting the dynamically allocated memory. I have most of the first half of the sheet filled out as you can see on line 40. Thanks.
Run the PointersLab.cpp code Add code to print the values of all the variables as indicated below and enter the results of running your code (verify the code is correct and makes sense). Enter the code to print these values before the process section of the code Copy and paste the code developed in step 2 below the process section in the lab code and enter the values again as they appear following the process section. ***** Draw a diagram showing how the pointers reference each other before the process section. In your diagram, show how the process section changes the initial connections, by putting an X through no-longer-valid connections and redrawing arrows for new connections. Also, draw an X through any memory that has been freed in the process section. Near the bottom of the main section, add code to free all memory that isn't automatically deallocated. 5) Eint main() { // Declarations & Definitions int a = 5; int*** p = new int**; *p = new int*; **p = &a; int*** q; int* r = new int*; *r = new int; **r = 10; int *t = new int; *t = 20; // Step 2 - Print values for variables here coutStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started