Is it safe to use malloc and it's derivatives with native C++ types? As sort of a learning experience I want to write my own stack class, first with integers, and I can't imagine how i'd write a dynamically sized array without using these functions. Are there, however, some alternative functions in C++?