Is there a way to determine the size of an object/variable that you have dynamically allocated memory to? For example:
returns 4, or the size of an int.Code:int foo() { int x; return sizeof(x); }
Is there a way to determine the size of the above dynamically allocated character array?Code:int foo() { char* data = new char[128]; int size = ???; delete {} data; return size; }