What's wrong!!


what's wrong with this code ? I've used it before and it works and gives me 2D array , but now when i opened the program again it represent numbers without stopping the loop !!! please help me

1
2
3
4
5
6
7
8
9
10
11
12
void twoDi(int Nums[][9],int sss) //calli
{
cout << "The Numbers in Two Dimensional Array: " << endl;
			for(int i=0; i<sss; i++)    //This loops on the rows.
			{
				for(int j=0; j<sss; j++) //This loops on the columns
				{
					cout << Nums[i][j]  <<"  ";
				}
				cout << endl;
			}
}
There is nothing wrong with this bit of code. Unless you passed a wrong value to sss..
"it represent numbers without stopping the loop" what does that mean?
Is sss the total number of items in the array? If so, try:


1
2
3
4
5
6
7
8
9
for(int i=0; i<(sss / 9); i++)    //This loops on the rows.
{
    for(int j=0; j<9; j++) //This loops on the columns
    {
        cout << Nums[i][j] << " ";

    }
    cout << end;
}


my sss was the problem i used the same variable for something else , that was the problem,
BTW the code was correct , thanks both :>
Topic archived. No new replies allowed.