title: C : Working with structures and pointers , error : invalid type argument of unary ‘*’
body: <p>I'm working on a c program and here is the structure I am using </p>
  
  <pre><code>struct EngineParts{
  
      int serial_number;
      unsigned int year_of_manufacture;
      unsigned int quantity;
      char *material;
  
  }*Eparts;
  </code></pre>
  
  <p>And I am getting the following error</p>
  
  <pre><code>`Automobile.c:79:5: error: invalid type argument of unary ‘*’ (have ‘unsigned int’)` 
  
  `Automobile.c:80:5: error: invalid type argument of unary ‘*’ (have ‘int’)` 
  
  `Automobile.c:81:5: error: invalid type argument of unary ‘*’ (have ‘unsigned int’)`
  </code></pre>
  
  <p>in these three lines</p>
  
  <pre><code> *new-&gt;quantity = quantity;
   *new-&gt;serial_number = serial_number;
   *new-&gt;year_of_manufacture = year_of_manufacture;
  </code></pre>
  
  <p>Here is the complete implementation</p>
  
  <pre><code>void automobile_add_part(const int serial_number,
          const unsigned int year_of_manufacture,
          const unsigned int quantity , 
          const char *material){
      /*
       * Store the address to the latest part
       */
     struct EngineParts *new ;
     new = (Eparts+available_number_of_parts);
  
      // Copying a String is a little bit complicated
      // First memory is allocated for the string 
      *new-&gt;material = (char *)calloc(strlen(material),sizeof(char));
      //Then the string is copied
      strcpy((char *)*new-&gt;material,material);    
  
      *new-&gt;quantity = quantity;
      *new-&gt;serial_number = serial_number;
      *new-&gt;year_of_manufacture = year_of_manufacture;
  
      available_number_of_parts++;
  }
  </code></pre>
  
  <p>PS : 
  I have checked out the following questions ,</p>
  
  <p><a href="https://stackoverflow.com/questions/5455866/error-invalid-type-argument-of-unary-have-int">error: invalid type argument of ‘unary *’ (have ‘int’)</a></p>
  
  <p><a href="https://stackoverflow.com/questions/4983010/invalid-type-argument-of-c-structs">Invalid type argument of -&gt; C structs</a></p>
  
  <p>but they don't seem to help me. </p>
  
  <p>Any suggestions on how to solve the problem ?</p>