Problem in pointer mcq

Q4 how does a memory leak occur?
Q8 Why program will not compile?

Q4. it is so because first the memory is allocated to pointer using malloc(1st statement) Jun 5 ✓✓
then the pointer is made to point to NULL. after that free statement is used which frees up the memory of ptr=NULL not the one allocated before. thus it leads to memory leak
Q.8 In some compilers void pointer arithmetic is not allowed(k++ is not allowed in some compilers)

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.