Skip to main content
๐Ÿ› Bug HuntC C Mediumโšก+20 XP

Memory Leak

This code allocates memory but has a bug.

๐Ÿ› Find the bug
1int *arr = malloc(5 * sizeof(int));
2for (int i = 0; i < 5; i++) arr[i] = i;
3// Program ends here
๐Ÿ› The bug is on line 3

๐Ÿ”ง Select the correct fix: