Why does this int randomly turn into a giant negative value?
<p>This function runs for a bit, then <code>proc_index</code> variable goes to -1886854513.  Is there something wrong with the code?</p>

<pre><code>int parse_words(vector&lt; vector&lt;string&gt; &gt; &amp;temp_word_vec, int num_of_sub_lists)
{
    char word[MAX_WORD_LENGTH+1]; // +1 makes room for a newline character
    int proc_index = 0; //index of word arr for child process "proc_index"
    string word_str;

    cerr &lt;&lt; "point1\n";
    while(fscanf (stdin, "%s", &amp;word) != EOF)
    {
        cerr &lt;&lt; "point2\n";
        for(int i = 0; i &lt; MAX_WORD_LENGTH; i++)
        {
            word[i] = tolower(word[i]);
            if(word[i] == '\0')
            {
                word_str.push_back('\n');
                word_str.push_back('\0');
                break;
            }
            if(isalpha(word[i]))
            {
               word_str.push_back(word[i]);
            }
        }
        cerr &lt;&lt; "point3, proc_index = " &lt;&lt; proc_index &lt;&lt; ", word is " &lt;&lt; word_str &lt;&lt; "\n";

        temp_word_vec[proc_index].push_back(word_str);

        ++proc_index;

        if(proc_index == num_of_sub_lists)
            proc_index = 0;
        word_str.clear();
    }

    return 0;
}
</code></pre>
