title: How to check spaces in a string C?
body: <p>I am trying to have my program take a name as input from the user and then print out the initials of that name. i.e. tommy brown --> tb</p>
  
  <p>What I have so far is this:</p>
  
  <pre><code>int main (void)
  {
  
  char scroll[100] = {"kang cheng junga"};
  printf ("%c\n", *(scroll+2));
  
  for (int i=0; i&lt;100; i++)
  {
      if (*(scroll+i)=" ")
      {
          printf (*(scroll+i+1));
      }
  }
  </code></pre>
  
  <p>I keep getting this error:</p>
  
  <blockquote>
    <p>error: incompatible pointer to integer
          conversion assigning to 'char' from 'char [2]'</p>
    
    <p>[-Werror,-Wint-conversion]
        if (*(scroll+i)=" ")</p>
    
    <p>error: using the result of an assignment as a
          condition without parentheses </p>
    
    <p>[-Werror,-Wparentheses]
        if (*(scroll+i)=" ")</p>
  </blockquote>
  
  <p>Can anyone tell me how I've screwed this up? I am having a hard time understanding how * and &amp; function in a C. I am a beginner so I don't really know what I'm doing. </p>