+ 2
After inserting, the str length will increases by 1 so you need to track that also in loop.
14th Jun 2022, 3:39 PM
Jayakrishna 🇼🇳
+ 2
Manav Roy How about this? https://code.sololearn.com/cvO2jZ2Wsqaz/?ref=app it is not very robust though. It fails on some negative numbers. It is suggested to use <locale.h> for more specific separators, like in India.
14th Jun 2022, 5:08 PM
Bob_Li
Bob_Li - avatar
+ 1
Manav Roy Are you sure,? You don't having camma inserted so is not it increase length? See 1000 (len=4) after insert 1,000 (len=5, with camma added)...!
15th Jun 2022, 3:50 PM
Jayakrishna 🇼🇳