Convert string to int


sir ,i pass all test case using above code
but when i try with next code below it print garbage value why?

@Korou you must understand how recursive call stacks work. After the base case returns the value of “sum” it gets returned to the previous FUNCTION CALL, not the MAIN function, and you are doing nothing with that value there, returning nothing eventually. hence garbage value gets printed. https://ide.codingblocks.com/s/208702 i modified your code a bit it is working now.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.