Line 17: You allocated some memory and made m[i] point to it
Line 30: You made t[i] point to same memory area as m[i]
Line 44: You deleting memory both t[i] and m[i] pointing to; both pointers now invalid.
Line 49: you are copying invalid pointer from t[i] to new m[i] array.
Line 44: You deleting memory both t[i] and m[i] pointing to; both pointers now invalid.
Line 49: you are copying invalid pointer from t[i] to new m[i] array.
At the next level I going to build a function that do it (add more lines to a dynamic array) so I have to delete one array in the function (and this why I delete m at the middle of the code).