expression must be a modifiable lvalue on struct pointer
<p>i'm trying to fill the Item type "temp" with values that are in the array "temp 
fields" (Contains strings) i get the "expression must be a modifiable lvalue" error on my ptemp pointer.</p>

<pre><code>typedef struct _item {
   char item_name[ITEM_NAME_LENGTH];
   char department[DEPARTMENT_NAME_LENGTH];
   char expiration_date[EXPIRATION_DATE_STRING_LENGTH];
   double price;
   int available;} Item;

Item create_item(char *s) {
    Item temp, *ptemp;
    ptemp = &amp;temp;
    char temp_fields[5];
    int n = 0;
    n = seperate_fields(s, "_*_", temp_fields);
    ptemp-&gt;item_name = temp_fields[0];
</code></pre>

<p>can anyone explain whay this is happening? im trying to modify the value that the pointer is pointing at. that suppose to be modifiable</p>

<p>i thank anyone who answers in advance</p>

<p>the edited code for item creation</p>

<pre><code>Item create_item(char *s) {
Item temp, *ptemp;
char *ptrend;
char *temp_fields[5];
int n = 0;
ptemp = &amp;temp;
n = seperate_fields(s, "_*_", temp_fields);
strcpy(ptemp-&gt;item_name, temp_fields[0]);
strcpy(ptemp-&gt;department,temp_fields[1]);
strcpy(ptemp-&gt;expiration_date, temp_fields[2]);
ptemp-&gt;price = strtod(temp_fields[3], &amp;ptrend);
ptemp-&gt;available = atoi(temp_fields[4]);
return temp;
</code></pre>