この関数は、メモリブロックを新しい場所に移動する場合があります。その場合、新しい場所が返されます。
たとえば、配列へのポインタがあります。
int *arr; // somewhere next it initialized, filled with elements and etc
どこかで私がする必要があります:
void* location = realloc(arr, NEW_SIZE);
古いメモリブロックプレイスはどうなりますか?
reallocが数学ではないポインタをarrに返す場合、次のコードを使用する必要がありますか?:
delete arr;
arr = (int*)location;