Reputation: 1
I have a problem here
void myFunction(char string){}
int main(void)
{
char test[] = "HEYYY";
myFunction(test);
}
Why does it give this error? error: invalid conversion from 'char*' to 'char' [-fpermissive]
Upvotes: 0
Views: 307
Reputation: 753475
Your function is, apparently, expecting a single character in a parameter (mis)named string
.
You probably need to fix the prototype (definition):
void myFunction(char *string);
void myFunction(char string[]);
Upvotes: 3
Reputation: 1264
Because myFunction
takes in a character, not a cstring. What do you want myFunction
to do? Did you mean void myFunction(const char *string) { }
?
Upvotes: 5