-
Array/Crashing
I ran this code and it froze on me. So I ran it again and it didn't. I ran it 20 times and it crashed again. I'm using arrays so the compiler doesn't spot these errors. Could you look over my short code?
Code:
#include <iostream.h>
int AI_PROCESS(int a[10][10])
{
cout<<a[0][0]<<" "<<a[1][0]<<" "<<a[2][0];
return 0;
}
int main()
{
int board[10][10];
board[0][0] = 0;
board[1][0] = 1;
board[2][0] = 2;
AI_PROCESS(board);
cin.get();
return 0;
}
-
>I ran it 20 times and it crashed again.
I think your computer's unstable, but:
>#include <iostream.h>
You should be using the new style headers:
Code:
#include <iostream>
using namespace std;
> cout<<a[0][0]<<" "<<a[1][0]<<" "<<a[2][0];
You might as well flush the output stream here with a endl.
cout<<a[0][0]<<" "<<a[1][0]<<" "<<a[2][0] << endl;
-
I'm pretty sure that the crashing isn't anything to do with running that code.
Try being more specific than "it crashes".
Like for example, the text of the error message(s), screen shots of dialogs, whatever...