+ 1
can any one answer y cant we use decrement operator (x--) as a argument while calling a function recursively..?
3 odpowiedzi
+ 4
You can, it just wont pass in the correct value. --x will however. Thats because the value of x AFTER the operation is passed in, unlike x-- where the value of x is passed in before the operation
+ 1
thanx aklex youre ans helped me a lot..
+ 1
@aklex sorry i need to correct you, but the operation is actually always evaluated before the function call in both cases. the difference is that the postfix implementation is coded to make a temporary copy, alter the value and then return the temp var. thats why you should rather use the prefix ++ then the postfix to prevent unnecessary copies!