I was doing an assignment for creating tokens and symbol table for a given input. But there's an Null Reference Exception occurred when handling variables into symbol table. I have searched out the internet but couldn't find the solution. I am a complete newbie in CC. Special thanks to him/her who helps out. The code of specific function where the error is occurring is given below please fix it...
for (int r = 1; r <= SymbolTable.GetLength(0);r++)
{
    //search in the symbol table if variable entry
    //  already exists
    if (SymbolTable[r, 2].Equals(finalArrayc[x].ToString()))
    {
        ind = SymbolTable[r, 1];
        ty = SymbolTable[r, 3];
        val = SymbolTable[r, 4];
        lin = SymbolTable[r, 5];
        tfTokens.AppendText("<var" + ind + ", " + ind + "> ");
        break;
    }
}
The NullReferenceException is on the line:
if (SymbolTable[r, 2].Equals(finalArrayc[x].ToString()))
 
     
    