0

my code is working perfectly as shown on test cases but why is it failing every test case.?

reversing a string. [code coach: extra terrestrial] https://code.sololearn.com/crLA30filGNt/?ref=app

8th Oct 2022, 7:01 AM
sahil somyani
sahil somyani - avatar
3 Respostas
+ 2
// Try it while(max>0) { std::cout << st1[max-1]; max--; }
8th Oct 2022, 7:07 AM
SoloProg
SoloProg - avatar
0
it is working perfectly now , but what was the problem before, can you plz explain it.
15th Oct 2022, 2:01 PM
sahil somyani
sahil somyani - avatar
0
sahil somyani , int max = st1.length(); // to get the array length std::cout << st1[max-1]; // to get the last index is "length - 1"
15th Oct 2022, 3:13 PM
SoloProg
SoloProg - avatar