void foo(char *){} ... foo("hi");
I have found three options to overcome this problem:
1. Add the 'const' keyword to the function definition:
void foo(const char *){}
2. Cast the string when calling the function:
foo((char *)"hi");
3. Create a char array to pass to the function:
char message[] = "hi"; foo(message);
Each might work better than the other 2 for a given situation. I leave it up to you to figure out which is best for your situation.
No comments:
Post a Comment