Not
Your program uses a lot of memory for I / O buffers, library data structures, the malloc system itself, command line arguments and environment, etc. (Some of them are on the stack.)
Yes, you can knock things out of range.
Keep in mind that x[i] is the same as *(x + i) . Thus, it is easy to calculate the address you are referring to. It can overlay one of your data structures, it can overlay a part of your data structure, which is a private field in the malloc mechanism, or it can overlay library data.
source share