It compiles, but l'm guessing you will segfault when the first element is anything other than 0. Pointers can be dereferenced as though they were an array as well. For instance:
Code:
int *p1 = new int[10];
int *p2 = new int;
*p1 = 10; // OK, same as p1[0] = 10;
p2[0] = 10; // OK, same as *p2 = 10;
p1[9] = 10; // Ok, since there are 10 elements
p2[9] = 10; // NOT ok, it only points to 1 int not an array
That last line is a segfault waiting to happen...