After realloc ptest contains new address and memory allocated will double the size of prvious memory.
realloc() is function allocated dynamically. we can modify the memory in terms of reducing or increasing memory for variables when it required then we can decrease or increase more than our prespecified memory, the free() function frees the previously allocate memory
Realloc function re-allocates previously allocated memory as per our requirement. we have to pass the pointer as first parameter, the size of new memory. Realloc has take care about the allocation, the data in pointer should not be changed and the location is changed depending on the memory size. It is pure 'C' native function.
free() function used to deallocate memory which allocated with malloc or calloc functions.
The realloc() function changes the size of the block pointed to by ptr to size bytes and returns a pointer to the (possibly moved) block. The contents will be unchanged up to the lesser of the new and old sizes. If the new size of the block requires movement of the block, the space for the previous instantiation of the block is freed. If the new size is larger, the contents of the newly allocated portion of the block are unspecified. If ptr is NULL, realloc() behaves like malloc() for the specified size. If size is 0 and ptr is not a null pointer, the space pointed to is freed.