(C++) terminate called after throwing an instance of ‘std::bad_alloc’ what(): std::bad_alloc
I wrote the code trying to serching a word in a string, for I was practicing pointer in C++.
first time when I tried this code is fine, but I wanted it to become decoupling and to practice passing pointer into function.
I then wrote some global function trying to perform the same things, but the concole kept saying things like the title.