我有以下代码:
interface ** rInterfaces[MAX_REACTANS];
_reaction->rInterfaces = (interface **)malloc(MAX_REACTANS * sizeof(interface *));
我收到一条错误消息:
error: incompatible types when assigning to type ‘struct interface **[10]’ from type ‘struct interface **’
我不知道为什么我会得到这个。任何帮助将不胜感激。
最佳答案
根据您的 malloc
判断,您需要一个指向接口(interface)的指针。从声明中删除 [MAX_REACTANS]
。您还可以删除 interface **
cast。
关于c - Malloc 指针数组错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9422916/