S
stephen henry
Hi all,
I have a question that I'm having difficulty answering. If I have a
struct:
typedef struct my_struct_tag{
struct my_other_struct *other;
} my_struct_tag
(I'm using the struct when declaring other because the definition of
my_other_struct is in another source file.)
Then, I want to access, from a different source file,
my_struct *tmp;
my_other_struct *other_struct;
tmp->other = other_struct;
But, for me, this gives a warning saying that the assignment assigns
different pointer types. If I change the code to:
tmp->other = (struct my_other_struct *)other_struct;
It works, but this is fugly. Is there anyway to assign like the first
method (ie without the cast).
Thanks,
Stephen Henry
I have a question that I'm having difficulty answering. If I have a
struct:
typedef struct my_struct_tag{
struct my_other_struct *other;
} my_struct_tag
(I'm using the struct when declaring other because the definition of
my_other_struct is in another source file.)
Then, I want to access, from a different source file,
my_struct *tmp;
my_other_struct *other_struct;
tmp->other = other_struct;
But, for me, this gives a warning saying that the assignment assigns
different pointer types. If I change the code to:
tmp->other = (struct my_other_struct *)other_struct;
It works, but this is fugly. Is there anyway to assign like the first
method (ie without the cast).
Thanks,
Stephen Henry