I think I\'ve got a good grasp on how to handle memory in C++ but doing it in C is different I\'m a bit off.
In C++ I\'ve got constructors and destructors, I\'ve got the
The usual way is
MyType *ptr = malloc(array_size * sizeof *ptr);
But if you want to be compatible with c++, do
MyType *ptr = (MyType*) malloc(array_size * sizeof *ptr);
You can also make a macro
#define MALLOC( NUMBER, TYPE ) ( TYPE * ) malloc( NUMBER * sizeof( TYPE ) )
MyType *ptr = MALLOC(10, MyType);
Of course, with no RAII, make sure sometime later you have
free(ptr);