ptr realloc(ptr,newsize)the function realloc(allocates new memory space of size specified by newsize to the pointer variable ptr it returns pointer to the first byte of the memory block the allocated new block may be or may not be at the same region thuswe see that realloc(takes two arguments the first is the pointer referencing the memory and the second is the total number of bytes you want to reallocate if you pass zero as the second argumentit will be equivalent to calling free(like malloc(and calloc()realloc returns void pointer if successfulelse null pointer is returned if realloc(was able to make the old block of memory biggerit returns the same pointer otherwiseif realloc(has to go elsewhere to get enough contiguous memory then it returns pointer to the new memoryafter copying your old data there howeverif realloc(cannot find enough memory to satisfy the new request at allit returns null pointer so again you must check before using that the pointer returned by the realloc(is not null pointer /*example program for reallocation*#include #include #define null int main(char *strstr (char *)malloc( )if(str==nullprintf("\ memory could not be allocated")exit( )strcpy(str,"hi")printf("\ str % "str)/*reallocation*str (char *)realloc(str, )if(str==nullprintf("\ memory could not be reallocated")exit( )printf("\ str size modified\ ")printf("\ str % \ "str)strcpy(str,"hi there")printf("\ str % "str)/*freeing memory*free(str)return note with realloc()you can allocate more bytes without losing your data dynamically allocating - array we have seen how malloc(can be used to allocate block of memory which can simulate an array now we can extend our understanding further to do the same to simulate multidimensional arrays if we are not sure of the number of columns that the array will havethen we will first allocate memory for each row by calling malloc each row will then be represented by pointer look at the code below which illustrates this concept #include #include