Meaning of an error message

returning ‘char’ from a function with return type ‘char *’ makes pointer from integer without a cast [-Wint-conversion]

What does this error mean?

#include<stdio.h>
char *getString()
{
char str[] = “Will I be printed?”;
return *str; //The error was here
}
int main()
{
printf("%s", getString());
getchar();
}

this means there is a mismatch of the return type that u are trying to return from the function call

just try returning str;
instead of *str

1 Like