My teacher gave us a piece of code as homework and asked us what is the kind of error.
I don't really know what errors exist so that's why I'm asking here.
#include <stdio.h>
int main()
{
int m, n;
scanf("%d%d", &m, &n);
int i, ** a;
a = (int**)malloc(m * sizeof(int*));
for (i = 0; i < m; i++)
{
a[i] = (int*)malloc(n * sizeof(int));
}
free(a[0]);
free(a);
return 0;
}
It is either a runtime error, a memory leak, or a linkedit error.
Can anybody help me classify this error and also help me understand the difference between these types of errors?
Thanks.