Is there a way in C to find out the size of dynamically allocated memory?
For example, after
char* p = malloc (100);
Is there
This may work, a small update in your code:
void* inc = (void*) (++p) size=p-inc;
But this will result 1, that is, memory associated with p if it is char*. If it is int* then result will be 4.
p
char*
int*
There is no way to find out total allocation.