x

Choose Country Code

x

Direction

x

Ask a Question

  • Ask a Question
  • Scan a Question
  • Post MCQ
  • Note: File extension must be of jpg, jpeg, png, bmp format and file size must not exceed 5 MB
x

Ask a Question

x

x
x
x
Hire a Tutor

Answers and Solutions

What's Your Question?
Answer
Using free() function.
Answer

Answer: Each time when you allocate memory at run time using malloc() or calloc(), the memory get allocated fom heap area. It is necessary to free the memory which is allocated dynamically at run time to avoid memory leaks. The free() function is used to free the memory which is allocated previously using malloc() or calloc().

Syntax: free(mem_ptr);

Here mem_ptr is a pointer to memory allocated using malloc() or calloc().

Example: 

int *p = (int *)malloc(sizeof(int));

free(p);

 

 

Answer
Using function free() we free the allocated memory. This is reverse of malloc or calloc and is included in stdlib.h header file.
Answer

You can use Free() function.

Answer

 

The following four dynamic memory functions can be found in the stdlib.h library:

To allocate space for an array in memory you use calloc()

To allocate a memory block you use malloc()

To reallocate a memory block with specific size you use realloc()

To de-allocate previously allocated memory you use free()

Answer
C free() Dynamically allocated memory created with either calloc() or malloc() doesn't get freed on its own. You must explicitly use free() to release the space.
Answer

Using function

free(pointer to allocated memory)

This is reverse of malloc or calloc and is included in stdlib.h header file

Answer
using free() function
Answer
If it is static allocation then then we cannot explicitly free the memory. If it is dynamic memory allocation then c language provides free() function to free the memory, the parameter of the function is the starting address of the memory(or block of memory). C++ provides an additional operator 'delete' to free the memory syntax : delete memory_address;
Answer
free function is used to deallocate memory which is allocated using malloc, calloc, etc. delete operator is used to deallocate memory, which is allocated using new operator.
Answer
By using the function- free()
Answer
Using free in c and delete in C++ .if ur using dynamic memory.otherwise it's. Otherwise required.
Answer
Through dealloc() function
Answer
Functions malloc(), calloc(), realloc() are used for dynamic allocation while free() used for deallocation of block allocated to by malloc(), calloc() or realloc().
Answer
when you specify free() the memory allocated will automatically de-allocated.
Answer
To allocate space for an array in memory you use calloc() To allocate a memory block you use malloc() To reallocate a memory block with specific size you use realloc() To de-allocate previously allocated memory you use free()

Post Answer and Earn Credit Points

Get 5 credit points for each correct answer. The best one gets 25 in all.

Post Answer