title: Assignment of struct char array to char array in C is giving an "incompatible types in assignment" error
body: <p>I am trying to assign a char array of size 88 to a structure's char array of size 88 property, but when I compile the program, I get:</p>
  
  <blockquote>
    <p>error: incompatible types in assignment</p>
  </blockquote>
  
  <p>Here is where I define my struct:</p>
  
  <pre><code>#define BUFFERSIZE 9
  /* Bounded Buffer item structure */
  typedef struct item {
     int  id;       /* String index value */
     char str[88];  /* String value */
  }item;
  </code></pre>
  
  <p>I declare the item as a global variable:</p>
  
  <pre><code>item buffer[BUFFERSIZE];
  int bufferFill;
  </code></pre>
  
  <p>I am setting the property in another file, so I declare them in the other file as well using extern:</p>
  
  <pre><code>extern item buffer[BUFFERSIZE];
  extern int bufferFill;
  </code></pre>
  
  <p>Inside of a function in the same file that I redeclared them as external global variables, I declare a new char array:</p>
  
  <pre><code>char outputString[88];
  </code></pre>
  
  <p>I originally had it as:</p>
  
  <pre><code>char * outputString; 
  </code></pre>
  
  <p>That gave the same error that I am still getting, so I tried changing it so that the array was declared with the same size as the one in the struct.</p>
  
  <p>After I fill outputStrings with data, I try to set the buffer's str array to outputStrings.</p>
  
  <pre><code>buffer[bufferFill].str = outputString;
  </code></pre>
  
  <p>This gives the error: </p>
  
  <blockquote>
    <p>incompatible types in assignment during compile time. </p>
  </blockquote>
  
  <p>I have no idea what is wrong. I have even done things similar to this before with no problems, so I don't understand what I'm doing wrong. I have set the other property of the item struct with no problem like this:</p>
  
  <pre><code>buffer[bufferFill].id = num;  // This gives no error
  </code></pre>
  
  <p>In setting the <code>str</code> property I have also tried:</p>
  
  <pre><code>buffer[bufferFill].str = (char *)outputString;
  </code></pre>
  
  <p>and </p>
  
  <pre><code>buffer[bufferFill].str = &amp;outputString;
  </code></pre>
  
  <p>I didn't expect those to work, but I tried them anyway. They of course did not work.</p>
  
  <p>I am completely lost as to what could be causing this when as far as I can tell, they are the same type.</p>