You are viewing a single comment's thread. Return to all comments →
Because after this line of code has been executed:
*a = *a + *b;
The value of 'a' has been changed.
And when the program reaches this line of code:
*b = abs(*a-(*b));
... you are using the new value of 'a', but you need its ORIGINAL value (hence why I store it in the variable 'temp').
Seems like cookies are disabled on this browser, please enable them to open this website
Pointer
You are viewing a single comment's thread. Return to all comments →
Because after this line of code has been executed:
The value of 'a' has been changed.
And when the program reaches this line of code:
... you are using the new value of 'a', but you need its ORIGINAL value (hence why I store it in the variable 'temp').