i have searched and experimented with the code,
and i don't know how to explain the problem.
the code is tiny and very simple.
#include <iostream>
using namespace std;
int field[2][2];
void draw()
{
for(int b = 0; b < 3; b++)
{
cout <<"\n";
for(int a = 0; a < 3; a++)
{cout << field[a][b];}
}
}
int main()
{
field[1][0] = 1;
draw();
cin.ignore();
}
if i have understood multidimensional arrays right
the screen should look like this:
010
000
000
but alas! every time i run the program it prints this:
010
000
100
if i write field[0][2] = 1; instead the same thing happens.
some parts of the array are connected with eachother
in some way.
is there something i have missed completely?
is my computer damaged in some way?
or are strange cosmical forces halting my work?

New Topic/Question
Reply




MultiQuote





|