Question: Function foo and two pointers p,sp are given below. 63 template 64 void foo(shared_ptr ptr) 65 { 66 *ptr = 67 } 68 auto
Function foo and two pointers p,sp are given below. 63 template 64 void foo(shared_ptr ptr) 65 { 66 *ptr = 67 } 68 auto p = new int(); 69 auto sp = (b) foo(p); TO); Are the following function calls legal? Any memory leak for each function call? Briefly explain your answers. (a) foo(sp); make_shared (); Enter your answer here (c) foo(shared_ptr(p)); Enter your answer here Enter your answer here
Step by Step Solution
There are 3 Steps involved in it
The image shows a snippet of C code defining a template function foo that takes a stdsharedptr and two variables defined using auto which are pointers ... View full answer
Get step-by-step solutions from verified subject matter experts
