Stephan van Hulst wrote:Hey there! Can you explain in your own words what the difference is between:
If you don't know the difference, look up what the difference is between prefix increment and postfix increment.
Take note that the correct words are "recursion" and "recursive", not "recrusion" and "recrusive".
prefix increment, the statement value is increased first before use, but postfix increment takes value and then increases.
counter = 0;
if (++counter) -- the counter is increased first and then the boolean check if (1)
if (counter++) -- counter is increased after use in statement if (0) and then make +1
Am I right ? But the problem still lies in recursion.
Stephan van Hulst
Joined: Sep 20, 2010
Actually no, there are no checks. The prefix operator first increases the variable, and then returns the value. The postfix operator increases the variable, but returns the value it was before the increment.
How could this affect your recursion?