Is there some kind of problem with this function as I have tried displacing each command but it still shows segmentation error
string splitSentence(string str)
    {
        string appendedWords{""},xx;
        for(int i=0 ; i < str.length();i++)
        {
            xx = str[i];
            if (xx == " ")
            {
                
                appendedWords = "";
            }
            else 
            {
                appendedWords = appendedWords + xx;
                
            }        
        }
    }
 
     
    