Nope, this is undefined behavior. And well that's why it may work and it may not. (Depends on the moon). You should avoid it. Don't think that this is making your program work by allocating more memory - it doesn't.
If you write this, you are writing in some part of your program's memory which will in turn result in errorneous result or if it is trying to write to some memory which is non-modifiable, you will get error. In either way you are invoking undefined behavior - anything may happen from crashing your code to a correct execution. Don't rely on that.
so if it's not allocating memory so where he is storing the elements. I just want to know what is happening internally in the system??
Well it is writing to the memory out of the bound of the array where it is not supposed to write. That is what is happening. That is why this is not what you should be doing. You are basically changing part of memory that program is being assigned and moreover which you are not supposed to change.