I know this is really easy and I’m looking over something but this is what I have…:
typedef struct
{
char s1[81];
char s2[81];
char s3[81];
}Rec;
int main()
{
Rec *a[10];
a[0] = (Rec*)new unsigned char(sizeof(Rec));
a[0]->s1= "hello";
printf("a[0] = %s\n",a[0]->s1);
delete(a[0]);
getchar();
return 0;
}
Now, the line
a[0]->s1= “hello”;
is complaining about the expression must be a modifiable lvalue. I am pretty sure it’s how I’m casting it in my new operator line and has it needs to be a long value or something but I’m not sure of the code to do this… easy i know but yeah. Any help would be much appreciated
You cannot assign to char arrays like that. Either use strcpy, or change your char arrays to
std::string.Why are you doing this:
instead of this: