我写了下面的代码,我想知道我已经完全保留了多少空间,但是如果我使用sizeof(p),它只会返回指针的大小。我怎么能得到2000?
void main(void){
int *p = (int * ) malloc(sizeof(int) * 1000 ) ;
//...The rest of the code comes here
p = ( int * ) realloc ( sizeof(int) * 2000 ) ;
// what function should i call with p in order to get
// the size of the reserved space that p is pointing to ????
}