Sumeet,
There is a small typo there.
dyn_arr = new[a];
dyn_arr = new[b] (dyn_arr);
When you do resize by the above method, the size is adjusted from a → b. So you will have a new size (b), means the existing array (a) contents copied to new array(of size b), and the old array is cleaned up.
‘b’ is the new size.
Kranthi