char *ptr="abc";
char *ptr1;
while(*ptr1++=*ptr++); //IT IS WORKING
while((*ptr1)++=(*ptr)++); //ERROR
PLS EXPLAIN ME.
[Added [code][/code].]
You haven't initialized ptr1: when you first dereference it, it is already undefined behavior, so "IT IS WORKING" is just plain "luck(?)".
In the "ERROR" line, the result of the ++ operator is not an lvalue, so it cannot be assigned to.
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314