Learn CS Visual

How Memory Errors Happen

Memory errors happen when memory is handled incorrectly. Common kinds include a buffer overflow, writing past the end of an array; a dangling pointer, still using a pointer after its memory has been freed; and a memory leak, losing every reference to memory that was allocated.

If an array has size 4, why is writing to arr[4] a problem?