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
int
there 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>
fromfct
has 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