answersLogoWhite

0


Best Answer

The answer is in the question: use function free.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How can you free alocated memory using c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What will happen if you allocate memory using new and free it using free or allocate sing calloc and free it using delete?

The C++ new uses malloc internally to allocate memory and the C++ delete uses free internally to revoke memory. However, they are not interchangeable and so memory allocated with new MUST be revoked with delete. If you mix them up, you will have a memory leak! Haya.


What is memory leakage in C?

When you are using pointers and you don't free memory after you stoped using it, you loose certain amount of memory, which you cannot use and system cannot use either because it was reserved. When you work with huge amounts of memory like arrays you can run out of memory which will cause a fatal error.


What is the difference between static memory versus dynamic memory?

Dynamic memory can be declared at run-time using the new and delete operators (or malloc and free in C), while static memory must be declared at compile-time.


What is dynamic mamory?

Dynamic memory refers to memory that is allocated and deallocated during program execution, as opposed to static memory which is allocated at compile time. In C and C++, dynamic memory allocation is done using functions like malloc() and free(), allowing for flexibility in managing memory resources at runtime. However, improper use of dynamic memory can lead to memory leaks or segmentation faults.


How does the free function work in c language?

free() marks the memory locations as available for malloc().


What are new and delete operators in c plus plus?

New and Delete are the memory management operators in c++,like c language we use malloc() and calloc() functions to allocate memory and free() functiong to release the memory similarily we use new to allocate memory in C++ and Delete to release the allocated memory....


How do you display matrix in c using dynamic memory allocation?

Memory allocation is not necessary to display a matrix.


What is the difference between delete and free?

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.


Max memory allocated by malloc in c?

Memory is allocated by malloc from the heap.... so max mem = size of heap that is free...


What command clears computer memory?

free(pointer_name) command used in c-language


C program for matrix multiplication using dynamic memory alllocation?

Poor boy


What is a distructor in c plus plus?

A destructor destroys an instance of a class to free up memory.