title: C function to capitalize first letter of words in an array
body: <p>I'm pretty new to C and am hitting a wall when creating the below function. I want to use this function to make the first letter of a word upper case for a static character array (char string[].  It looks ok to my eye, but I'm getting some syntax errors which are probably pretty basic.
  compiler errors:</p>
  
  <blockquote>
    <p>error: invalid conversion from <code>const char' to</code>const char*'
    initializing argument 1 of `size_t strlen(const char*)'
    assignment of read-only location</p>
  </blockquote>
  
  <pre><code>  void Cap(char string[]){
      int i;
      int x = strlen(string);
      for (i=1;i&lt;x;i++){
           if (isalpha(string[i]) &amp;&amp; string[i-1] == ' '){
           // only first letters of a word.
               string[i]= toupper(string[i]);
           }if (isalpha(string[0]))
                          {
                            string[0]=toupper(string[0]);
                          }
           }
  }
  </code></pre>