-
No portable way, no.
Some operating systems (such as Windows) allow you to do this. But it means you must use OS allocation functions since it's implementation-defined how malloc allocates its memory.
Some versions of the C library on some compiler vendors has a function to allow you to see how large it is, but again, this only exists as extensions.
So the answer would be: keep track of it yourself. That's how C++ does it, and so should you.
-
Ok thanks Elysia, in this example here I got it in the variable 'size' so that should be easy.