Omitting the return statement from a function whose return type is not void is cause for undefined behavior.
when i change the return type of
intthere is no problem.
That’s a valid form of undefined behavior. It can be considered lucky/unlucky depending on how you view it. I consider it unlucky since the problem remains hidden.
returning
vector<string>fromfcthas resolved the problem as well.
That’s the correct way to implement a function that’s supposed to return a vector<string>.
solved Segmentation fault when function returns