Line 1117: Char 9: runtime error: reference binding to null pointer of type ‘int’ (stl_vector.h)
Line 1117: Char 9: runtime error: reference binding to null pointer of type ‘int’ (stl_vector.h)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:1126:9
Can anyone tell me why this program shows a runtime error?
There are no errors in the compiler. So, I submitted it to the online judge. I get correct answers when there is no runtime error. And all the samples are also showing correct answer. I also tried putting it into valgrind, but it also returns 0 errors from 0 contexts.
Runtime Error: terminate called after throwing an instance of ‘std::out_of_range’
Not too sure what is causing the error. I’ve tried debugging but everyone works fine in the debugger.