GeekInterview.com
Series: Subject: Topic:
Question: 482 of 587

What is the purpose of realloc( )?

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 n specifies the new size.The size may be increased or decreased.If n is greater than the old size and if sufficient space is not available subsequent to the old region, the function realloc( ) may create a new region and all the old data are moved to the new region.
Asked by: Interview Candidate | Asked on: Mar 6th, 2005
Showing Answers 1 - 1 of 1 Answers
BRN Prasad

Answered On : Mar 13th, 2006

The main purpose of the realloc is to reallocation the memory aquired by any variable.In between u want to increase the size of it (if ur array becoming bigger) .. or if u want to reduce its size (if that data element do not need that much memory u had already allocated)...

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.