[Solved] Debug Assertion Failed Vector Subscript Out of Range C++

[ad_1]

blah[j] = strInput;

This is undefined behaviour because blah is empty. Which means the compiler can make the program do anything.

When compiling with the right settings, Visual C++ makes use of that undefined behaviour in the C++ standard in order to actually detect the bug and show you this error message.

Fix the bug by using push_back instead:

blah.push_back(strInput);

3

[ad_2]

solved Debug Assertion Failed Vector Subscript Out of Range C++