If the structure has been allocated dinamically (i.e. through a call to
malloc
or
new
), you can use the
_msize (CRT)[
^] function to get the size of the allocated memory block; however that could not be the size of the structure (e.g. if you use it on the pointer obtained by calling
new MyStruct[10]
what you get is
sizeof(MyStruct) * 10
).
Anyway, why couldn't you use the
sizeof
operator?