title: How to solve the error: assignment to expression with array type
body: <p>I am asked to create a <code>carinfo</code> structure and a <code>createcarinfo()</code> function in order to make a database. But when trying to allocate memory for the arrays of the brand and model of the car, the terminal points out two errors. </p>
  
  <p>For: </p>
  
  <pre><code>newCar-&gt;brand =(char*)malloc(sizeof(char)*(strlen(brand) + 1));
  newCar-&gt;model = (char*)malloc(sizeof(char)*(strlen(model) + 1));
  </code></pre>
  
  <p>it says that there is an error: assignment to expression with array type and an arrow pointing to the equal sign.</p>
  
  <pre><code>struct carinfo_t {
  
      char brand[40];
      char model[40];
      int year;
      float value;
  
  
  
  };
  
  struct carinfo_t *createCarinfo(char *brand, char *model, int year, float value){
  
     struct carinfo_t *newCar;
     newCar=(struct carinfo_t*)malloc( sizeof( struct carinfo_t ) );
  
      if (newCar){
           newCar-&gt;brand =(char*)malloc(sizeof(char)*(strlen(brand) + 1));
          newCar-&gt;model = (char*)malloc(sizeof(char)*(strlen(model) + 1));
         strcpy(newCar-&gt;brand, brand);
          strcpy(newCar-&gt;model, model);
          //newCar-&gt;brand=brand;
          //newCar-&gt;model=model;
          newCar-&gt;year=year;
          newCar-&gt;value=value;
      }
      return newCar;
  
  
  };
  </code></pre>