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 2 of 3.

Anju said:   1 decade ago
Can you please explain what is the meaning of

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

Vahitha said:   1 decade ago
What is the difference between alloc(), malloc(), calloc(), please give the clear idea?

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

Jhansi said:   1 decade ago
In that program I want to meaning of p=(int**)malloc(MAXROW*sizeof(int*)).

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.

Kirthi said:   1 decade ago
dealloc() functions can free the memory space right?

Murugan said:   1 decade ago
Can you write a simple program of memory allocation?

Sham said:   1 decade ago
Please explain about calloc( ) and malloc( )?

Abhi said:   9 years ago
What is the advantage of malloc and calloc?


Post your comments here:

Your comments will be displayed after verification.