the pointers mcq has this question where it asks what the error is and then gives this code
int main()
{
int *ptr = (int *)malloc(sizeof(int));
ptr = NULL;
free(ptr);
}
and the answer shows that the error is memory leak but ptr is freed over here, in fact there is no return statement so shouldn’t that be the error. either way please clarify. Thank you !