while preparing to the end of semester exam I have stumbled upon the following question:
Given this piece of code:

```
#include <stdio.h>

int main() {

    const char *const ptr1[] = {"to be", "or not to be", "that is the question"};
    char *ptr2 = "that is the question";

    (&ptr2)[3]="hamlet";
    for (int i = 0; i < sizeof(ptr1) / sizeof(*ptr1); ++i)
        printf("%s ", ptr1[i]);
    return 0;
}

```

prints the following: "to be hamlet that is the question"

I thought that this code wouldn't compile.

However, the code compiles.

can someone please help me understand why does this code behave like that ?