I have created a typedef structure as shown below which consists of 4 fields and i have inserted as array of structures which can be seen below
typedef struct Signal {
long vr;
char name[20];
char Type[20];
char casuality[20];
} Signal;
I have used array of structures as shown below
void xmlRead()
{
int i;
Signal var[4];
var[0].vr=1073741824;
strcpy(var[0].name,"Ball1_pos");
strcpy(var[0].Type,"Real");
strcpy(var[0].casuality,"output");
var[1].vr=1073741825;
strcpy(var[1].name,"Ball2_pos");
strcpy(var[1].Type,"Real");
strcpy(var[1].casuality,"output");
var[2].vr=1073741826;
strcpy(var[2].name,"Ball1_vel");
strcpy(var[2].Type,"Real");
strcpy(var[2].casuality,"output");
var[3].vr=1073741827;
strcpy(var[3].name,"Ball2_vel");
strcpy(var[3].Type,"Real");
strcpy(var[3].casuality,"output");
for(i=0; i<=3; i++)
{
while(var[i].casuality="output") **//Here it is showing error as expression must have modifiable lvalue//**
{
//Some statements
}
}
}
whileloop, it is just that you try to assign a(const char *)value (a pointer to an anonymouschararray"output") to thechar [20]variablecasualityin thei-th item of yourvararray. Same error will arise for a standalone declarationchar casuality[20];and an assignmentcasuality = "xxx";Confusion of assignment=and comparision==is another problem, and yet another is 'comparing` string characters with ordinary==operator (which doesn't work for char arrays as you would expect).