why does "Array out of bounds exception" error occur when tryin to complie

Can you please post the code you're trying to compile?

Actually im not trying to complie any code, it will be a question in my C++ exam which will be held next week. So please if you could define the error with some examples it would be of great help. Thankyou for your fast response

Example I:

int array[5];
int el;
el = array[5]; // out of bound
el = array[6]; // out of bound

Example II:

int array[5];
int *p, el;
p = array;
el = *(p+5); // out of bound
el = p[7]; // out of bound

> it will be a question in my C++ exam which will be held next week.
How do you know this?

What's next, multi-choice papers with the correct answer displayed in the bold font?

<old-fogey-mode>
All the exams I ever did were seen for the first time in the exam room. Sure, I had seen past papers, and had some idea what might be asked, but there were never any "gimme" questions you could rely on.
</old-fogey-mode>

it will be a question in my C++ exam which will be held next week.
How do you know this?

What's next, multi-choice papers with the correct answer displayed in the bold font?

<old-fogey-mode>
All the exams I ever did were seen for the first time in the exam room. Sure, I had seen past papers, and had some idea what might be asked, but there were never any "gimme" questions you could rely on.
</old-fogey-mode>

I'm sure u've heard of past papers brother, but have you ever heard of future papers. i think you haven' tright? dude i was just kidding. Its like this;

my C++ exam is supposed to be held coming wednesday, so my C++ lecturer has given us a hand out consisting of fourty question and he said that twenty out of fourty questions form the hand out will be selected and will be included in the exam. So thats what I was trying to figure out the answers to all the question. Anywayz thanks for replying to my thread and I hope that I've cleared your doubts.

Edited 3 Years Ago by Reverend Jim: Fixed formatting

That may be true, but you've to understand the answer we're giving to you, just learn everything by heart is not right the way to become a successful C++ programmer, you really have to understand what you're doing :)

BTW, I think your teacher's intention is that you look it up in your course :P

That may be true, but you've to understand the answer we're giving to you, just learn everything by heart is not right the way to become a successful C++ programmer, you really have to understand what you're doing :)

BTW, I think your teacher's intention is that you look it up in your course :P

Dude, what do you think that i'm doing right now?
I'm jus trying to take anwers from real people without referring any books or the web so that I could get a practical answer!!!

I think you haven't read this carefully enough:

BTW, I think your teacher's intention is that you look it up in your course

Have you tried to look it up in your course before starting this thread?

I think you haven't read this carefully enough:

Have you tried to look it up in your course before starting this thread?

Oops!! soory dude!! my bad..nyways thanks for helping me

Oops!! soory dude!! my bad..nyways thanks for helping me

Never mind, I would find it strange that a teacher asks you things on your exam, where you don't have any notes of :P

This article has been dead for over six months. Start a new discussion instead.