How the array a[n-1] is giving us last digit?
String to integer recursion
hello @vanshikasharma1645
in array we use 0 based indexing (i.e 1 st element is stored at index 0 , 2nd at index 1 ,similarly nth element at index n-1)
so if our array size is n and we want to access it last element then we will need index n-1
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.