pass by reference doesnt seem to change anything with either functions, still gives wrong result like some random number for matching ( so "for ( int i = 0; i < min(first.size(), second.size()); i++ )" probably won't work) and joinit() function that joins 2 strings makes blank space. In fact these functions dont even run properly when called from main, but when I put both functions matchexact() and jointhem() into makewords() function then they start computing - in this case joinit works, but matcheaxact() gives wrong result. Is there something wrong with how my functions are called from main?