I am writing a function that should return Hello world!, but it returns Hello Wo.. I added a cout right before my return statement to check the value and it is correct.
I pass two parameters into the function, one and two, and my function combines the word and returns. I wrote a loop to transfer one into a new char so the original passed value isn't effected since I am accessing it's array.
Function:
char* myStrCat(char inputOne[], char inputTwo[]){
int sizeOne = myStrLen(inputOne);
int sizeTwo = myStrLen(inputTwo);
char functionTemp[100];
for(int tempReplace = 0; tempReplace < sizeOne; tempReplace++){
functionTemp[tempReplace] = inputOne[tempReplace];
}
for(int i = 0; i < sizeTwo; i++){
functionTemp[i + sizeOne] = inputTwo[i];
}
cout << "check: " << functionTemp << endl;
return functionTemp;
}