On the discussion of dynamic memory here: \"Intro to C Pointers and Dynamic Memory\"
The author states:
A memory block like this can effective
Using variable sized arrays on the stack as an auto variable (instead of the heap using calloc/malloc/new/etc) is not a bad idea for a process that is going to run for a long time and will need to make and destroy lots of little arrays. This is because the stack is guaranteed not to ever become fragmented, while memory can and will get fragmented. If you are writing firmware or a service that needs to run for years without stopping, you are almost prohibited from using malloc or new.