C++ Programmer Question:
Download Questions PDF

Explain void* realloc (void* ptr, size_t size)?

C++ Programmer Interview Question
C++ Programmer Interview Question

Answer:

This function is used to change the size of memory object pointed by address ptr to the size given by size. If ptr is a null pointer, then realloc will behave like malloc(). If the ptr is an invalid pointer, then defined behaviour may occur depending the implementation. Undefined behaviour may occur if the ptr has previously been deallocated by free(), or dealloc() or ptr do not match a pointer returned by an malloc(), calloc() or realloc().

Download C++ Programmer Interview Questions And Answers PDF

Previous QuestionNext Question
Explain me what is implicit conversion/coercion in c++?Please explain the volatile and mutable keywords?