C allocation places static or stack variable allocations next to each other. So when you overrun a you are accessing b’s allocation. If you reversed the declaration order of a and b then an overrun of a would corrupt the stack.
note: you should really use a better c compiler. Your examples often use uninitiated variables. Most modern c compilers mark the first page of memory as inaccessible, so a runtime error is thrown when accessing memory location zero.