I got a warning C4047: 'return': 'char' differs in levels of indirection from 'char *' from my compiler. I'm new to coding and don't understand how to fix this problem.
My code is:
char upperToLower(char word[])
{
int i;
for (i = 0; i < 25; i++)
{
word[i] = tolower(word[i]);
}
return word;
}
Can anyone help me with the code?
the array number for char word[] is 25, so char word[25].
Word is the pointer to char not char. Your function returns char not pointer to char.
It should be:
And I personally prefer
as it is less confusing for the beginner C programmers.
If the
wordis the C string (null char (or another words zero ) terminated char array) it should look like this: