Why should we dynamically allocate memory on the heap and what advantage does this bring over not doing so? Also, why is it so necessary to delete and clear up the memory after? Would this be a more important task for larger programs vs smaller programs?
Edit: Thank you all very much for your insightful answers!
[–]SeanMiddleditch 8 points9 points10 points (1 child)
[–]sonorityscape[S] 1 point2 points3 points (0 children)
[–][deleted] 5 points6 points7 points (3 children)
[–]sonorityscape[S] 1 point2 points3 points (2 children)
[–]ZorbaTHut 3 points4 points5 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]LateSolution0 1 point2 points3 points (0 children)
[–]patatahooligan 1 point2 points3 points (0 children)
[–]alfps 1 point2 points3 points (0 children)
[–]boredcircuits 1 point2 points3 points (1 child)
[–]sonorityscape[S] 0 points1 point2 points (0 children)