This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

#138 expression must be a modifiable lvalue

Hi friends,

I initialize array i.e

static uint8 DTC_Record[6][8] = {
{'0','1','1','4','1','7','8','6'},
{'0','2','1','4','1','7','8','6'},
{'0','3','1','4','1','7','8','6'},
{'0','4','1','4','1','7','8','6'},
{'1','0','1','4','6','7','8','6'},
{'1','1','4','4','1','7','8','6'}
};

in another function I am receiving array as 

void ReadDTC_Record(uint8 (*dtc_rec)[],uint8 len);

In this function I am trying to copy DTC_Record values in dtc_rec variable.

I am doing like this:

do //virtual condition
{
rd_addr = (*DTC_Record + (rd_ptr * DTC_REC_SIZE));
ReadFromEEPROM(rd_addr, DTC_REC_SIZE, *dtc_rec);
rd_ptr--;
NumOfRecordRead++;
(*dtc_rec)++;                                                                          //Here it is showing (expression must be a modifiable lvalue ) 

}while((rd_addr >= *DTC_Record) && (NumOfRecordRead <= len));

Regards,

Arvind

 

  • This is more a C question than an MCU question, so I may be going out on a limb. You defined DTC_Record as a two dimensional array of uint8. You define dtc_rec as an array of pointers to unit8. They are not the same thing.