Creating new structure for trees in C++
<p>I will keep it short. When I run the code, I enter the first character (e.g: 'k') and everything is fine. Second time I enter a character (e.g: 'j') I get an error and the compiler says that it is on the line (that has a comment). Please help. Thank you.</p>

<p>Code:</p>

<pre><code>struct nodeType{
    char letter;
    nodeType*leftNode;
    nodeType*rightNode;

};
void putInNode(nodeType*n,char c){
    if ((char)(n-&gt;letter) &gt;='a' &amp;&amp; (char)(n-&gt;letter) &lt;='z')/* ERROR IS HERE*/
    {
        if(n-&gt;letter &lt; c)
            putInNode(n-&gt;leftNode, c);
        else
            putInNode(n-&gt;rightNode, c);
    }
    n-&gt;letter=c;
}
int main(){
    nodeType*a=new nodeType();
    char c;
    do {
        cin &gt;&gt; c;
        if(c=='.')
            break;
        putInNode(a,c);
    } while (true);
    cout &lt;&lt; a-&gt;letter &lt;&lt; endl;

}
</code></pre>
