Hi all.
Code says more than thousand words
This gives me:
I would like to know why I get this warning and how I can avoid it "the right way".
Any help will be appreciated.
Code says more than thousand words
PHP:
int
main(int argc, char **argv)
{
char s[64]; /* s is of type (char *) here, right? */
char **p;
/*
* This assignment warns me about "assignment from incompatible
* pointer type"
*/
p = &s;
/*
* This works without warning. But as I'm not sure why I have to cast
* here I would like to avoid it... Or to make sure this is legal and
* not too bad style. So, what do you think about it?
*/
p = (char **)&s;
return (0);
}
This gives me:
Code:
gcc -Wall --ansi test.c
test.c: In function `main':
test.c:11: warning: assignment from incompatible pointer type
I would like to know why I get this warning and how I can avoid it "the right way".
Any help will be appreciated.