I am not sure if both of these works to delete:
p = new int[1];
delete p
and
delete [] p;
If both works, what is the difference between the above two deletes?
An array of one instance is still an array. There is simply not a special case, so you need to treat it as an array and not a single object. Non-array delete may crash.
An array of objects may be preceded by a number signifying the size of the array. If that's the case, delete[], not delete, is smart enough to pass the correct pointer to free.
They are not the same. Even though delete p would compile but could potentially cause problems at runtime.
delete p will invoke operator delete(void*) where as delete [] will call operator delete[](void*). The default behavior is for delete[] to call delete but if a custom operator for delete [] has been implemented, it won't be called if you just call delete and you'll have a problem (probably a silent one).
Good rule of thumb is if you used [] in the new, use it in the delete.
newanddeletemust match, or you have undefined behavior. Seeming to work on one platform is a possible outcome of undefined behavior, as is crashing everything terribly. Don't do it.