Converting a cstring to camelcase
<p>So my task is to fill out my function to work with a test driver that feeds it a random string during every run. For this function I have to convert the first character of every word to a capital and everything else must be lower.</p>

<p>It mostly works but the issue i'm having with my code is that it won't capitalize the very first character and if there is a period before the word like:</p>

<blockquote>
  <p>.word</p>
</blockquote>

<p>The 'w' in this case would remain lower.</p>

<p>Here is my source: </p>

<pre><code>void camelCase(char line[])
{
    int index = 0;
    bool lineStart = true;

    for (index;line[index]!='\0';index++)
    {
        if (lineStart)
        {
            line[index] = toupper(line[index]);
            lineStart = false;
        }

        if (line[index] == ' ')
        {
            if (ispunct(line[index]))
            {
                index++;
                line[index] = toupper(line[index]);
            }
            else
            {
                index++;
                line[index] = toupper(line[index]);
            }
        }else
            line[index] = tolower(line[index]);
    }
    lineStart = false;

}
</code></pre>