Re: Strange array problem
From: Chris \( Val \) (chrisval_at_bigpond.com.au)
Date: 03/10/04
- Next message: Sumit Rajan: "Re: Strange array problem"
- Previous message: Sami Lakka: "Strange array problem"
- In reply to: Sami Lakka: "Strange array problem"
- Next in thread: Sumit Rajan: "Re: Strange array problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 11 Mar 2004 00:39:36 +1100
"Sami Lakka" <sami.lakka@tut.fi> wrote in message news:c2n48r$t81$1@news.cc.tut.fi...
| Hi,
|
| I might be just missing something ridiculously simple but why does my arrays
| that
| are in private variables interfere with each other.
| Here is the output:
|
| 2 2 2 2
| 2 2 2 2
| 2 2 2 2
| 2 2 2 2
|
| 3 3 3 2 -- WHY THIS???
| 2 2 2 2
| 2 2 2 2
| 2 2 2 2
[snip]
Because, you are exceeding the array bounds, and
overwriting memory you don't own.
In your class you declare:
double matrix[3][3];
[snip]
Here you declare:
| const double MATRIX_SIZE = 4;
[snip]
Additionally, look through the magic numbers sprinkled
throughout your code, and you should immediately realise
where the errors are.
Cheers.
Chris Val
- Next message: Sumit Rajan: "Re: Strange array problem"
- Previous message: Sami Lakka: "Strange array problem"
- In reply to: Sami Lakka: "Strange array problem"
- Next in thread: Sumit Rajan: "Re: Strange array problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|