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

Off-by-One in Loop

This loop writes past the array boundary.

๐Ÿ› Find the bug
1int arr[5];
2for (int i = 0; i <= 5; i++) arr[i] = i;
๐Ÿ› The bug is on line 2

๐Ÿ”ง Select the correct fix: