This function takes in a const char* of a cstring and a const char of where to split within the string. The function correctly splits strings into a char** and returns it. To make the function look cleaner I made a strCopy function which works correctly outside this fucntion. But when strCopy is used within the function visual studio throws a critical error. But to make things even more interesting if you uncomment the commented code and remove the strCopy function the data gets copied correctly and no error is thrown. So why does my strCopy function not work?