Originally posted by funkydude9
But should it work? I mean, it output's the same number I input.
As stated, it's undefined. It could give you the output you want, it may crash. It may do nothing at all. It's undefined.

It may work until you throw something else on the stack that changes the contents of that address, at which point it will crash, or perhaps continue on merrily.

Again, as stated, boundry checking is left entirely up to the programmer. You can make a pointer try and point at any space of memory you like. You can even then try and dereference it or change it. However, if it's not something you've allocated specificly, you have no idea of knowing what will happen, because it's not yours to use.

Quzah.