I don't know what is wrong with the if statement here
<p>I would like your help identifying the problem with the if statement in this code.
In this code int columns = 5; and int nextElement grows by 1 each time this code is run. </p>

<pre><code>if(nextElement + 1 != columns) {
    cout &lt;&lt; "Passed check!" &lt;&lt; endl;
    if(cArray[0][nextElement + 1] == "&lt;empty&gt;") {
        nextElement++;
    }else{
        nextElement = nextElement + 2;
        while(content != "0" || nextElement != columns) {
            if(cArray[0][nextElement] == "&lt;empty&gt;") {
                content = "0";
            }else{
                nextElement++;
            }
        }
    }
}else{
    //happens when (nextElement + 1) == columns
}
</code></pre>

<p>It compiles fine.
But for some reason, when nextElement + 1 = 5, the program stops.
This Error message pops up:
"Unhandled exception at 0x77de15de in classes_5.exe: 0xC0000005: Access violation reading location 0xcdcdcde5."</p>

<p>I've tried assigning nextElement + 1 to another int variable, and also tried changing the 
operators in the if statement. Nothing works! I have no idea what I'm doing wrong.
Please help!</p>

<p>And thank you for your time!</p>

<p>Hello again,
I think I possted more code than necessary.
I'm sorry about that.</p>

<p>In answer to some of the comments: 
cArray is a string. 
    string **cArray;
No I'm not completely sure what empty does...</p>

<p>I would just like to know if
I'm doing anything wrong with the if statement
at the very top. 
Thank you again.</p>
