C: Incompatible types?
Posted
by
Airjoe
on Stack Overflow
See other posts from Stack Overflow
or by Airjoe
Published on 2011-03-02T07:17:16Z
Indexed on
2011/03/02
7:24 UTC
Read the original article
Hit count: 242
#include <stdlib.h>
#include <stdio.h>
struct foo{
int id;
char *bar;
char *baz[6];
};
int main(int argc, char **argv){
struct foo f;
f.id=1;
char *qux[6];
f.bar=argv[0];
f.baz=qux; // Marked line
return 1;
}
This is just some test code so ignore that qux doesn't actually have anything useful in it.
I'm getting an error on the marked line, incompatible types when assigning to type ‘char *[6]’ from type ‘char **’
but both of the variables are defined as char *[6]
in the code. Any insight?
© Stack Overflow or respective owner