[Solved] segmentation fault for vector iterator

In this declaration: vector<int>::iterator rit_i,rit_j,initial = vec.end(); only initial is initialized with vec.end(). To make it do what I think you expect, you have to write vector<int>::iterator rit_i = vec.end(), rit_j = vec.end(), initial = vec.end(); or vector<int>::iterator rit_i,rit_j,initial; rit_i = rit_j = initial = vec.end(); or something to that effect. solved segmentation fault for … Read more