User Profile

Collapse

Profile Sidebar

Collapse
xunter
xunter
Last Activity: Apr 26 '13, 12:42 PM
Joined: Nov 25 '11
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • xunter
    replied to Delete a dynamically allocated 2d array of bool
    in C
    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.
    See more | Go to post

    Leave a comment:


  • xunter
    replied to Delete a dynamically allocated 2d array of bool
    in C
    Look at the ctor:

    Code:
    BinaryMatrix::BinaryMatrix(int rowSize, int colSize) {
    	_row = rowSize;
    	_col = colSize;
    
    	_matrixArr = null;
    
    	InitMatrixArray();
    };
    I use this class like below

    Code:
    BinaryMatrix *bm = new BinaryMatrix(nRow, nCol);
    ...
    delete bm;
    I am a newbie in c/c++ and I can make a stupid mistake......
    See more | Go to post

    Leave a comment:


  • xunter
    started a topic Delete a dynamically allocated 2d array of bool
    in C

    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];
    ...
    See more | Go to post

  • xunter
    replied to Out of bounds exception
    in Java
    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
    */
    ...
    See more | Go to post

    Leave a comment:


  • xunter
    replied to Out of bounds exception
    in Java
    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....
    See more | Go to post

    Leave a comment:


  • xunter
    replied to Can't get date value
    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
    }...
    See more | Go to post

    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....
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...