C- Memory Allocation
C- Memory Allocation
1. What function should be used to free the memory allocated by calloc() ?
- dealloc();
- malloc(variable_name, 0)
- free();
- memalloc(variable_name, 0)
2. 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;
}
#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);
3. Specify the 2 library functions to dynamically allocate memory?
- malloc() and memalloc()
- alloc() and memalloc()
- malloc() and calloc()
- memalloc() and faralloc()