P
PX
Greetings,
Please take a look at following code:
"
struct STR {
char string[32];
... /* something else */
};
int main(int argc, char *argv[])
{
struct STR *ptr;
ptr->string = argv[2];
}
"
The compiler complained "invalid lvalue in assignment" when I tried to
compile. I am wondering why a char pointer can work fine but
ptr-string can't. Is there any fast method that can get this done
instead of writing a for loop to assign characters one by one?
Thanks a bunch!
Regards,
PX
Please take a look at following code:
"
struct STR {
char string[32];
... /* something else */
};
int main(int argc, char *argv[])
{
struct STR *ptr;
ptr->string = argv[2];
}
"
The compiler complained "invalid lvalue in assignment" when I tried to
compile. I am wondering why a char pointer can work fine but
ptr-string can't. Is there any fast method that can get this done
instead of writing a for loop to assign characters one by one?
Thanks a bunch!
Regards,
PX