>WHY am I allowed to do this???????
You are not allowed to do this. Undefined behavior is, well, undefined behavior. It could behave how you think is "correct", it could crash, it could something completely different.
Now I'll admit, if all undefined behavior required something hideously harsh like reformatting your hard drive, programmers would learn very quickly what not to do. But this kindness granted to us by language implementors should not be overlooked.
Reputation Points: 2780
Solved Threads: 312
long time no c
Offline 4,790 posts
since Apr 2004