Question: void function ( int y ptr ) { y ptr = 1 0 ;delete y ptr;int y 2 ptr = new int ( 1 5

void function(int y ptr){y ptr =10;delete y ptr;int y2 ptr = new int (15);return ; }int main(){int main ptr = new int (12); function(main ptr);return 0 ; }1. Explain the difference between stack memory and heap memory[Total Marks 15]2. Refer to the code listing above and identify when the memory for each of the following pointers and their pointees is released y ptr y2 ptr main ptr

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!