0

I have made two structs,

Struct1:

struct candy { char *colour; struct cadny *next; };

Struct 2:

struct result { struct candy *container1; struct candy *container2; };

I have written a function which takes two pointers of type struct1, and returns a struct2.

But,

struct result r = removeCandy (container1, container2); container1 = r -> container1; container2 = r -> container2;

While doing this in main function, I am getting error,

1.c:44:18: error: invalid type argument of ‘->’ (have ‘struct result’) container1 = r -> container1; ^ 1.c:45:18: error: invalid type argument of ‘->’ (have ‘struct result’) container2 = r -> container2;

What I am doing wrong?

0 Answers0