UGC NET CS 2023Programming Languages and Computer Graphics › Programming in CVerified
UGC NET CS 2023 PYQ: How will you free the memory allocated by the following program? #include <stdio.h> #include <stdlib.h>…
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 * size of (int*));
return 0 ;
}- Amemfree $\text{(int p)}$;
- Bdealloc $\text{(p)}$;
- Cmalloc $(\mathrm{p}, 0)$;
- Dfree $\text{(p)}$:Correct answer
Answer
(D) free $\text{(p)}$:
Approach
Release heap memory with the standard C function paired with malloc.
Reviewed by UGC IQ Editorial Team.