Header file for Bezier curve utility
Raw memory management should be incredibly rare and a last resort.

Your best bet will be some kind of container that can manage the memory for you. Returning a pointer to an allocated chunk of memory has all kinds of problems (who owns it and thus should delete[] it? what if you forget to release it? what about exception safety? etc). 

In your situation, std::vector is almost certainly the right choice. It has essentially the same performance as a raw array if it's used wisely, and it gives pleasant, safe value semantics to an otherwise dangerous dynamic allocation.

In addition to the standard containers, it can also be valuable to know about std::shared_ptr and std::unique_ptr1. They give ownership semantics to memory allocations and facilitate safe handling of dynamically allocated memory. More plainly, they allow for the automatic releasing (e.g. delete or delete[]ing) of a memory allocation when the smart pointer (or all of the smart pointers in the case of std::shared_ptr) goes out of scope scope.



1 If you cannot use C++11, there are also some Boost smart pointers that do not require C++11.