Question about C Pointers (just learning)

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2010-04-18T03:09:55Z Indexed on 2010/04/18 3:13 UTC
Read the original article Hit count: 185

Filed under:

I am curious as to why this is an error and what the error message means. Here is some code.

int *x[] = {"foo", "bar", "baz"}; int *y[] = {"foo", "bar", "baz"};

x = y;

I try to compile and I get this:

error: incompatible types when assigning to type ‘char [3]’ from type ‘char *

Question #1 why is this an error? and Question #2 why are the types different?

Thanks for you help.

© Stack Overflow or respective owner

Related posts about c