Sum of Two Arrays

Please tell what is the error in the code here :- https://ide.codingblocks.com/s/413562, Not able to debug where it is going wrong and please specify the error or the line number where is the error is.

hello @Sakshi2004

made some changes ->

debug for
4
9 9 9 9
4
9 9 9 9

check now->

I did dry run for the testcase provided and the code worked, but why is it not working when running the code? Not able to debug the error, Please tell the error in the code,

check my last response , have already shared ur updated working code

But why is that while loop not working? Not able to understand the changes done for that adding carry.

carry will never be greater than 1. so simply check whether it is 1 or not

Ya that is correct, but it should work also because we are checking if carry > 0 and we are doing simply adding the carry value, so why is it printing some garbage kind of value.

check now->

u were updaating a array instead of ans array :man_shrugging:

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.