Free in C Language
Free ( ) : Compile time storage of a variable is allocated and released by the system in accordance with its storage class with the run time allocation, it is our responsibility to relies the space , when it is not required. The relies of storage space becomes important when the storage is limited.
When we no longer need the data we store in a block of memory and we do not intend to use that block for storing any other information, we may relies that block of memory for future use, using the free ( ) function.
Example :
free (ptr);
Where ptr is the pointer to a block of memory, which has been allocated from the heap on request. This function is void in nature and does not returned anything.
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment