+ 2
Unexpected output
I was trying to throw a string inside a try-catch block. The code compiles, but there is a runtime error(maybe not an error) and an unexpected output. Please help explaining the output. Thanks. https://code.sololearn.com/c62NQglHAf2r/?ref=app
2 Answers
+ 7
you can not use string, it must be a const char*
Here is your example with the appropriate changes
https://code.sololearn.com/cb1v1ytx0ZrV/?ref=app
+ 3
@jay Thanks. I got my mistake, I was throwing a const char* but catching a string.