adplus-dvertising
frame-decoration

Question

How will you free the memory allocated by the following program?
#include <stdio.h>
#include  <stdlib.h>
#define MAXROW 2
#define MAXCOL 3
int main()
{
    int **p, i, j;
    p = (int **) malloc(MAXROW * sizeof(int*));
    return 0;
}

a.

memfree(int p);

b.

dealloc(p);

c.

malloc(p, 0);

d.

free(p);

Posted under C Programming

Answer: (d).free(p);

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. How will you free the memory allocated by the following program?