answersLogoWhite

0


Best Answer

Are you talking about freeing dynamically allocated memory in C/C++? free() is a function that you use to release dynamically (i.e. at run-time) created memory in C, using malloc() or alloc() or such other functions. In the same way, delete() is a function that is used in C++ to release memory created at run-time using the function new(). (Note that you can still use malloc and other C functions in your C++ code, but it is not considered a good programming habit. Moreover, new() is easier to use and more flexible, once you get the hang of it.

If this is not what you had in mind, then I do not know if this will be of any help to you.

addition:

-new is constructor of which delete is destructor so use in pairs always.. similarly use malloc with free..

extra note:

- no type cast required for new , whereas malloc, free may require it.

- new returns exception whereas malloc returns NULL when memory issue.

User Avatar

Wiki User

โˆ™ 2010-09-30 16:11:24
This answer is:
๐Ÿ™
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between delete and free?
Write your answer...
Submit
Related questions

Difference between format and delete?

What is the difference between delete and format?


What is the difference between delete and delete?

delete is used to destroy a single object. It will call the destructor of the object and free the memory. delete[] is used to free the memory which was allocated using new []. delete [] will call the destructor for each object in array and free the memory. ________________ As far as I can tell, they aren't delete bit different.


What is the difference between delete and delete in C plus plus?

I'm presuming you mean the difference between delete and delete(). If not please clarify in the discussion section (punctuation is not permitted in questions). There is no difference between delete and delete(). Delete is an operator implemented as a function so the operand (a dynamically allocated instance pointer) can be placed in parenthesis if desired, but is not required.


What is the difference between Insert and Delete?

Delete erases something. Insert adds something.


Difference between constructors and destructors?

Constructor construct assign the value of class object while destructor delete or free memory which is allocated by constructor.


What is the difference between inorganic and organic proteins?

dont delete


What is the differences between the delete key and the backspace key?

No difference at all


What is the difference between delete and delete sheet command?

delete command would delete selected word,line, paragraph or even sheet. Whereas delete sheet command would delete the whole sheet


What are the difference between interest free and conventional banking system?

difference between interest and interest free financing


What is the difference between free will and destiny?

You can change free will


What is the Difference between fiber optics and free space optics?

difference between fiber optical and free space optical


The difference between free enterprise and laissez faire?

There is no difference.


What is difference between delete file in DOS and delete file in Windows?

i don't know the difference but what i know is ... deleted file from MS-DOS is never go to the recycle bin. Thanks !


Difference between the delete key an the back space?

The backspace key deletes to the left of the cursor, and the delete key deletes to the right of the cursor.


What is the difference between sugar free with sugar gum?

The difference is that there is less calories in sugar free gum


What is the difference between sugarless and sugar-free gum?

No difference.


What is the difference between backspace and delete key?

The backspace key erases characters to the left of the cursor. The delete key erases characters to the right of the cursor.


What is the difference between sugar and sugar free gum?

the difference is that sugar free gum does not have sugars in it and does not give you cavities.


What is the difference between fixed form poetry and free Verse?

The main difference is that Fixed has a rhyme scheme and Free does not.


Difference between fat free cheese and cheese?

fat free cheese is fat free


What is the difference between free blubster and upgrade?

one is pro and one is free


The difference between sugar gum and sugar-free gum?

The difference between sugar gum and sugar free gum? the difference is sygar gum is made of edible crystallines. sugar free gum consists of no sugar at all.


Difference between wrinkle free and wrinkle resistance?

Wrinkle free and wrinkle resistance sounds same but there is some difference .


What is the difference between Liberty Party and the Free Soil Movement?

The difference between the Tea Party and the Free Soil party was that the free soil party had different views and tactics of how things should be ran.


What is the difference between undo and redo action?

Undo will delete last action performed, and Redo will repeat

People also asked

What is public access of a class?

View results

You want many conditions to be satisfied for a single while loop how can you do it?

View results

What is quick bubble sort?

View results

Difference between private and protected specifier in c plus plus language?

View results