My professor is having us make our own version of the functions mystrcat, mystrlen and mystrcopy. I have a problem where the word is returning the wrong amount of bytes. Or, rather, I think it is.
The phrase: "HELLO WORLD!" , if I am not wrong, should return 13 bytes? Like in:
const char char_literal[] =
{ 'H', 'E', 'L', 'L', 'O', ' ', 'W', 'O', 'R', 'L', 'D', '!', '\0' };
// 1 2 3 4 5 6 7 8 9 10 11 12 13
I wrote the function myStrLen() that returns ({ 'H', 'E', 'L', 'L', 'O', ' '}) as 6, but because it is alone, there should be a '\0' at the end right?
So should I be returning i + 1 or is 6 correct?
int myStrLen(char stringInput[]){
for(int i = 0; ; i++){
if(stringInput[i] == '\0'){
return i;