T
Theo Stauffer
Hi all, this is my first (utter C newbie) post, so I beg your patience.
I have a little code snippet:
typedef struct listtype {
struct list *list_ptr;
}list;
list l1,l2;
int main ()
{
l1.list_ptr = &l2;
}
When I try to compile this under Mac OSX, I get a compiler warning that
I'm assigning an incompatible pointer type. The strange and confusing
thing is that, in the 2 C tutorials I have they have conflicting
instructions on how to do this. The one says that it's fine, the other
doesn't.
However, when I change this to:
typedef struct listtype {
struct listtype *list_ptr;
}list;
list l1,l2;
int main ()
{
l1.list_ptr = &l2;
}
then it's happy and compiles. Is this a gcc version thing or am I (most
probably) just completely misunderstanding something? Be grateful for an
answer.
-Theo Stauffer
I have a little code snippet:
typedef struct listtype {
struct list *list_ptr;
}list;
list l1,l2;
int main ()
{
l1.list_ptr = &l2;
}
When I try to compile this under Mac OSX, I get a compiler warning that
I'm assigning an incompatible pointer type. The strange and confusing
thing is that, in the 2 C tutorials I have they have conflicting
instructions on how to do this. The one says that it's fine, the other
doesn't.
However, when I change this to:
typedef struct listtype {
struct listtype *list_ptr;
}list;
list l1,l2;
int main ()
{
l1.list_ptr = &l2;
}
then it's happy and compiles. Is this a gcc version thing or am I (most
probably) just completely misunderstanding something? Be grateful for an
answer.
-Theo Stauffer