From my code, I can't trace the out of bounds exception.

Posted by Matt on Stack Overflow See other posts from Stack Overflow or by Matt
Published on 2010-05-04T20:16:47Z Indexed on 2010/05/04 20:28 UTC
Read the original article Hit count: 240

Filed under:
|
|
public override Models.CalculationNode Parse(string expression)
{
    var calNode = new Models.CalculationNode();

    int i = expression.Length;
    char[] x = expression.ToCharArray();
    string temp = "";

    //Backwards assembly of the tree

    //Right Node
    while (!IsOperator(x[i]) && i > 0)
    {
        if (!x[i].Equals(' ')) temp = x[i] + temp;
        i--;
    }
}

It has been a while since I've used trees and I'm getting an out of bounds exception in the while loop.

© Stack Overflow or respective owner

Related posts about segmentation

Related posts about fault