C Programming - Structures, Unions, Enums - Discussion
Discussion Forum : Structures, Unions, Enums - General Questions (Q.No. 1)
1.
How will you free the allocated memory ?
Discussion:
50 comments Page 1 of 5.
Safi said:
1 decade ago
Delete means increase space but at that deleted location take over by next allocated data. Hence that memory address is not free permanently.
While free means at that location space for another data entry. This location is not fill without user sent data by taking that reference.
While free means at that location space for another data entry. This location is not fill without user sent data by taking that reference.
Alex said:
1 decade ago
Free (var-name) used to free the memory which is occupied by that variable, but variable will be there and we can reuse it in our program.
But,
If if we can reuse it in our program again then it should occupies some memory.
Is there any one having some clearance. ?
But,
If if we can reuse it in our program again then it should occupies some memory.
Is there any one having some clearance. ?
Papon said:
1 decade ago
Free release the memory space occupied by the variable and the memory is available for further use on the other hand delete would delete the entire memory space occupied by the variable and the memory is not available for further use.
Vishal said:
1 decade ago
We used the free () function to free dynamically allocated memory. Such as malloc () and alloc ().
And we use the delete for destroy an object.
Or another way we can say that for explicitly destroyed we used delet.
And we use the delete for destroy an object.
Or another way we can say that for explicitly destroyed we used delet.
Vishal said:
1 decade ago
The heap is reason of free because of that our program can use memory via c's DYNAMIC ALLOCATION function.
But in delete() function asks the user to specify the index of the address that to be deleted.
But in delete() function asks the user to specify the index of the address that to be deleted.
Vendhan said:
1 decade ago
free() is the built in function in C, when we want to remove the allocated space of variable (ex. like A is the variable) given the syntax free(a); the allocated space memory come out free.
Sathish said:
1 decade ago
free(referred location name);
free() - built in function to free or clear the memory space. If you use free, the referred memory location released for the future use or other operations.
free() - built in function to free or clear the memory space. If you use free, the referred memory location released for the future use or other operations.
Tejas said:
1 decade ago
free(referred location name);
free() - built in function to free or clear the memory space. If you use free, the referred memory location released for the future use or other operations.
free() - built in function to free or clear the memory space. If you use free, the referred memory location released for the future use or other operations.
Nitish Dhok said:
1 decade ago
If you allocate the memory using new then you should deallocate using delete and if you allocate the memory using malloac then you must deallocate is using free.
Soujanya said:
1 decade ago
How can we decide that its asked for deallocating the dynamically allocated memory?
As we use free to deallocate the dynamic memory allocation.
As we use free to deallocate the dynamic memory allocation.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers