Difference between realloc() and free?

Answer Posted / fathimath fahima j

free :
#include <cstdlib>
Void free (void *ptr);

Free() function returns the memory
Pointed to by ptr to the heap. 

Realloc :
#include<cstdlib>
Void *realloc(void *ptr,size_t size);

The realloc function changes the size of
the previously allocated memory pointed to by ptr to dat specified by size.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

This program numbers the lines found in a text file. Write a program that reads text from a file and outputs each line preceded by a line number. Print the line number right-adjusted in a field of 3 spaces. Follow the line number with a colon, then one space, then the text of the line. You should get a character at a time and write code to ignore leading blanks on each line. You may assume that the lines are short enough to fit within a line on the screen. Otherwise, allow default printer or screen output behavior if the line is too long (i.e., wrap or truncate). A somewhat harder version determines the number of spaces needed in the field for the line numbers by counting lines before processing the lines of the file. This version of the program should insert a new line after the last complete word that will fit within a 72-character line.

1639


What is polymorphism explain its types?

682


INSTANCE FIELDS DECLARED private ARE ACCESSIBLE BY THE METHODS ONLY.CAN WE CHANGE THE private FIELD OF AN OBJECT IN A METHOD OF SOME OTHER OBJECT OF THE SAME CLASS?

1634


hi, this is raju,iam studying b.tech 2nd year,iam want know about group1 and group2 details, and we can studying without going to any instutions? please help me.

1541


What is new keyword in oops?

591






What are the types of abstraction?

557


What are the benefits of polymorphism?

624


Will I be able to get a picture in D drive to the c++ program? If so, help me out?

1657


What are benefits of oop?

639


What are main features of oop?

633


What is the significance of classes in oop?

590


i=20;k=0; for(j=1;k-i;k+=j<10?4:3) { cout<

1417


What polymorphism means?

622


write knight tour problem which is present in datastructure

2164


What is the importance of oop?

611