0 votes
in C Plus Plus by
What is the purpose of realloc in C Language?

1 Answer

0 votes
by
It increases or decreases the size of dynamically allocated array. The function realloc

(ptr,n) uses two arguments. The first argument ptr is a pointer to a block of memory for which

the size is to be altered. The second argument specifies the new size. The size may be increased

or decreased. If sufficient space is not available to the old region the function may create a new

region.
...