OK, thanks all. I have located a problem in my code. There was the index out of bounds error in some code in which I read\write items outside the array range.
Now, I change the bool** to bool* and also I allocate memory by malloc and access 2d array items by row * colCount + col. And, finally, I cleen the allocated memory in the destructor by the free function. But I guess that the previous code also will work properly.
User Profile
Collapse
-
Look at the ctor:
I use this class like belowCode:BinaryMatrix::BinaryMatrix(int rowSize, int colSize) { _row = rowSize; _col = colSize; _matrixArr = null; InitMatrixArray(); };
I am a newbie in c/c++ and I can make a stupid mistake......Code:BinaryMatrix *bm = new BinaryMatrix(nRow, nCol); ... delete bm;
Leave a comment:
-
Delete a dynamically allocated 2d array of bool
I have the code that goes bellow. I use Visual Studio and try to debug my program.
...Code:... int _row; int _col; bool **_matrixArr; ... BinaryMatrix::~BinaryMatrix() { for (int i = 0; i < _row; i++) { delete [] _matrixArr[i]; } delete [] _matrixArr; }; void BinaryMatrix::InitMatrixArray() { bool **matrix = new bool*[_row]; -
Ok. You should use a "split" method like below:
...Code:void main(String[] args) { String inputString = "some string"; String[] words = inputString.split(" "); for (int i=0; i<words.length; i++) { System.out.println(words[i]); } } /* Out: some string */Leave a comment:
-
You can't use an increment of the "i" variable. It will increment itself because you are using a "for" loop.
So a reason is the line "i++;" in the "while" block....Leave a comment:
-
I think that the line is here:
Result.Add(ETAT F[x]);
jamilou, You should write like below:
if (ETATF != null)
{
Result.Add(ETAT F[x]);
}
else
{
// do something else
}...Leave a comment:
-
I think that you should use the ViewState collection in situations like above instead Cache because the ViewState is only for each page and the Cache object is for an application....Leave a comment:
No activity results to display
Show More
Leave a comment: