Exceptions when trying to access beyond the array bounds

what all errors is possible if u write past the array bounds??

This is one of the interview questions which i thought could bring to a discussion here.

Only possible one I can think of is

segmentation fault in case of gcc compiler while it is access violation exception in case of the visual studio.!

Is there an errors possible apart from this?
When accessing beyond array boundaries, you are verging into the "undefined behavior" section of the C++
standard, and at that point anything is possible.

well, sometimes nothing happens :)

and make them explain why that is the case...
Last edited on
nothing is one of the possible things that can happen when I say anything is possible.
Guys.. Well.. Anything is possible is agreed.. But what are all the errors you have come across from ur experience..

Buffer overruns (aka writing beyond array bounds) are one of the main ways virus writers can execute rogue
code on your machine.

Segmentation faults, bus errors, variables getting trashed, all kinds of weird stuff that are too numerous to
even begin listing.
Topic archived. No new replies allowed.