Hello, I've been trying to figure out this problem for a while now and cant figure it out. What im trying to do is assign a value to a location in an array. SIMPLE! isnt it. well heres my problem.
int main(){
int array[1][1];
.
.
.
array[0][1]=-1;
array[1][0]=-2;

cout<<array[0][1]<<" "<<array[1][0];
.
.
.
}
the output is -2 -2. I have no clue as to whats going on. Ive tried changing it to array[1,0] but i got some errors. Does anyone know whats going on?

Thanks in advance.

First, the array you declared has only ONE element in each of the two dimensions. If you want them to have two elements then declare it like this: int array[2][2]; >> Ive tried changing it to array[1,0]
That doesn't work in C or C++.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.