Can over running of array lead to the catastrophic failures? If ‘Yes’ then why does not C++ provide bound checking on array operations and who is responsible to prevent array overruns?

Hello Sofia, thank you for the question.

Accessing an array outside of its bounds will always, always result in an outright, runtime crash of your application. This is because you are then accessing memory that has not been allocated.

C++ provides no checking and leaves that behavior to the actual programmer. This is due to a number of reasons. Maybe you want to do custom error handling. Maybe you want to display a message. Maybe you want to delete some memory you have allocated.

It is also worth noting that there would be performance hits associated with such a mechanism.

I hope this information was helpful.

- Eddie


All Answers

Answers by Expert:

Ask Experts




I can answer questions about the C++ language, object oriented design and architecture. I am knowledgable in a lot of the math that goes into programming, and am certified by ExpertRating.com. I also know a good deal about graphics via OpenGL, and GUIs.


I have completed numerous games and demos created with the C++ programming language. Currently employed as a software engineer in the modeling and simulation field. I have about 7 years experience.

©2016 About.com. All rights reserved.