c中结构的错误

时间:2016-06-06 17:30:35

标签: c++ c gcc

我制作了两个结构,

Struct1:

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

结构2:

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

我编写了一个函数,它接受struct1类型的两个指针,并返回一个struct2。

但是,

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

在main函数中执行此操作时,我收到错误,

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;

我做错了什么?

0 个答案:

没有答案