Question: (a) (5 points) Complete the following (silly) function implementation so that no memory is leaked. void facebook() { int linkedin 7; int hi5 &linkedin;
(a) (5 points) Complete the following (silly) function implementation so that no memory is leaked. void facebook() { int linkedin 7; int hi5 &linkedin; intorkut= new int [4]; orkut; int friendster int bebo [0] = &friendster [3]; bebo [1] new int; bebo [2] bebo [0]; bebo= new int [3]; // add code to free each piece of dynamically // allocated memory exactly once } (b) (3 points) Write the line of C++ code that declares a variable named album whose type is a vector of dynamic arrays of BMPs. (c) (2 points) Briefly describe the two instances when the destructor is called.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
