C++ char comparison not working
<p>It is probably better to say I am doing something wrong rather then say the comparison isn't working.  But, I have been going over this code for some time now.</p>

<p>I have a recursive function.  Most of it is working well, so I will only put the part that isn't working:</p>

<pre><code>//In main
string C[] = {"S=&gt;bS",
                    "S=&gt;aaT",
                    "T=&gt;aT",
                    "T=&gt;bU",
                    "U=&gt;Ua",
                    "U=&gt;aa"};
CFG CFG1(C);

...

string *code;
char startNT;
//The CFG constructor 
CFG::CFG(string C[])
{
    code = C;
    startNT = code[0][0];
}

...

//Inside of processData recursive function
for(unsigned int i = 0; i &lt; code-&gt;size(); i++)
{
    if(code[i][0] == startNT)
    {
        string newStr = code[i].substr(code[i].find("&gt;")+1);
        string old = wkString;
        //This is the recursive call
        if(processData(inString, wkString.replace(wkString.find_first_of(startNT), wkString.find_first_of(startNT)+1, newStr)))
        {
            return true;
        }
        cout &lt;&lt; wkString &lt;&lt; endl;
        wkString = old;

    }
}
</code></pre>

<p>The comparison that isn't working is code[i][0] == startNT .  Well... I should say, isn't working 100% of the time.  It works great until half way through the recursive function, code[i][0] becomes 'S' and startNT becomes 'T' (after already proving that it can compare 'S' and 'T' properly somewhere during the call), and it still evaluates to true, which causes the wkString.replace() to break since it can't find the 'T'. </p>

<p>It has been awhile since I have used C++, so I am probably making a stupid mistake.  Thanks for any help.</p>
