Question: 4. Consider the following C++ code int b, d //LINE 1 a- new int; a-3 b - new int //LINE 2 I/LINE 3 //LINE 4
4. Consider the following C++ code int b, d //LINE 1 a- new int; a-3 b - new int //LINE 2 I/LINE 3 //LINE 4 //LINE S -8a d &b; //LINE7 //LINE 8 //LINE 9 delete "c; "c new int; //LINE 1e I/LINE 11 //LINE 12 //LINE 13 delete d; d- new int d 10; //LINE 14 //LINE 15 //LINE 16 //LINE 17 a. List all leaked memory allocations (give line numbers where allocated). b. Give line number(s) of delete calls on pointers that do not point to valid memory allocations. Give line number(s) of invalid pointer dereferences. c. d. If somehow this code does not crash or horribly corrupt memory, what would it print
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
