Question: Where in the following code segment should a delete statement be put? Explain. (C++) int * p = new int ; // line 1 int

Where in the following code segment should a delete statement be put? Explain. (C++)

int * p = new int ; // line 1

int * q = new int ; // line 2

* p = 32; // line 3

* q = 20; // line 4

cout << 2 * (* p ) << " " << (* q - 5) << endl ; // line 5

q = p ; // line 6

* p = 10; // line 7

cout << * p << " " << * q << endl ; // line 8

p = new int ; // line 9

* p = 12; // line 10

* q = 62; // line 11

cout * p << " " << * q << endl ; // line 12

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 Databases Questions!