C Programming - Memory Allocation - Discussion

Discussion Forum : Memory Allocation - General Questions (Q.No. 3)
3.
How will you free the memory allocated by the following program?
#include<stdio.h>
#include<stdlib.h>
#define MAXROW 3
#define MAXCOL 4

int main()
{
    int **p, i, j;
    p = (int **) malloc(MAXROW * sizeof(int*));
    return 0;
}
memfree(int p);
dealloc(p);
malloc(p, 0);
free(p);
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
25 comments Page 3 of 3.

Renuka said:   1 decade ago
When we can use dealloc().

Ashok said:   1 decade ago
Yes I agree with seema & ram by free() memory is from allocation.

Muruganandam said:   1 decade ago
free() function is used for to free the memory space.

Seema said:   1 decade ago
It is a obvious answere because memory is freed by free() function. Which is option D.

Sai ram said:   2 decades ago
Any allocation functions like alloc () , malloc () and calloc () should release their memory space with free () function only.


Post your comments here:

Your comments will be displayed after verification.