[try Beta version]
Not logged in

 
Whats the difference?

Jan 19, 2011 at 7:44am
I know the first one is assigning the actual values in the array into the other one but whats happening in the second while?

1
2
3
4
5
6
int i =0;
while(dest[i++]=src[i++]);

AND

while(*dest++ = *src++);

Jan 19, 2011 at 10:44am
closed account (4Gb4jE8b)
it's called the dereference operator, see http://www.cplusplus.com/doc/tutorial/pointers/
basically what it's saying is that as the index of the two arrays increase, they remain equal to each other, while the other is saying whatever dest is pointing to increments as the value src points to increments.

Usually though, it would seem to me to make it a conditional operator in a while statement '==' so i'm not really sure what's going on in the code
Jan 19, 2011 at 10:49am
Yes, I was also confused why there was no == there but basically what you are saying is that the first one makes the values of the two arrays equal while the second version is increasing the "address" of the array?
Topic archived. No new replies allowed.