GeeksforGeeks » C/C++ Programming Questions
Explain functionality of the given recursive C function
(2 posts)-
int func(int i) { if(i%2) return (i++); else return func(func(i-1)); } -
If n is odd then returns n, else returns (n-1). Eg., for n = 12 you get 11 and for n = 11 you get 11. In this statement "return i++" returns value of i only as it is a post increment.
Reply
You must log in to post.