C Pointer - C programming (MCQ) questions for Q. 27514

Q.  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;
}

- Published on 26 Feb 17

a. memfree(int p);
b. dealloc(p);
c. malloc(p, 0);
d. free(p);

ANSWER: free(p);

Post your comment / Share knowledge


Enter the code shown above:
 
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)