Get Started
1939

Q: How would you free the memory allocated by the following program? #include "alloc.h" #define MAXROW 3 #define MAXCOL 4 main() {      int **p, i;      p = (int **) malloc (MAXROW * sizeof (int *));       for ( i = 0; i < MAXROW ; i++)             p[i] = (int *) malloc (MAXCOL * sizeof (int )); }

  • Show Answer
  • Workspace

Answer :
Explanation :

for ( i=0; i < MAXROW ; i++) free (p[i]); free (p);

The Most Comprehensive Exam Preparation Platform

Get the Examsbook Prep App Today