I have this piece of code, and it runs perfectly fine, and I don\'t why:
int main(){
int len = 10;
char arr[len];
arr[150] = \'x\';
}
Because you were lucky. Or rather unlucky, because it means it's harder to find the bug.
The runtime will only crash if you start using the memory of another process (or in some cases unallocated memory). Your application is given a certain amount of memory when it opens, which in this case is enough, and you can mess about in your own memory as much as you like, but you'll give yourself a nightmare of a debugging job.