i need better understanding with pointers ( ordinary pointers)

Refering to the following code, identify when the memory for each of the following variables is released:
(a) a_ptr
(b) a_ptr's pointee
(c) b_ptr
(d) b_ptr's pointee
(e) x
(f) z
(g) y_ptr
(h) y_ptr's pointee
(i) y2_ptr
(j) y2_ptr's pointee

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

  int* function( int x, int* y_ptr )
 {
 	int z = x + *y_ptr;
 	delete y_ptr;
 	int* y2_ptr = new int (15);

 	return y2_pt r;
 }

 int main()
 {
 	int* a_ptr = new int(5);
 	int* b_ptr = function (12,a_ptr);
 	delete b_ptr;

 	return 0 ;
 } 
We do not offer homework solutions here. Please try your best and ask a specific question when you get stuck.
Topic archived. No new replies allowed.