What if I don’t use int len and instead pass stringtoInt(a, 4)
Len variable usage
What will be the call stack for this? not able to visualize it.
let say the string is “123”
123 - call on - > 12 - call on -> 1 - call on ->0
return 123 <- 12 * 10 +3 < -return 12 < - 1 * 10+2 <- return 1 - 0*10 + 1 <–return 0
this is how stirng “123” get converted into 123
I meant is the value of n in recursive call is independent of the value of n which is used to extract digit?
…
yeah, the value of n in current function and the value of n in next recursive call are totally independent
Okay thanks that makes sense.
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.