I have a problem using the recursion.
what is the difference between these 2 codes?
Code:void test(int i) { if(i==5) return; test(i+1); cout<<"print\n";//why this part is accessed???? }
suppose we have called it by test(1);
in the above code why the cout<<"print\n" portion is accessed when i execute the progeam.
i understand what recursion is.
i believe this is called tail recursion.but i cant understand its behaviour.
can you give me an idea on this?
please explain the its behaviour.