If you called malloc, you called it with the size of the amount of space you wanted. If you want to know later on how big the allocation is, you need to keep that information around yourself.
Since your using C++, you could useIf you called malloc, you called it with the size of the amount of space you wanted. If you want to know later on how big the allocation is, you need to keep that information around yourself.
If that's too much trouble, since your using C++, you could use a <vector>
or similar, which will track its own size. a vector or similar, which will track its own size.