我有一个基本的类型转换问题...我有一个结构无效*为结构*用C
typedef struct teststruct {
int a;
} test;
和简单的功能
void testfunc(void **s)
{
printf("trying malloc\n");
s[0] = (test*)s[0];
s[0] = (test*)malloc(sizeof(test));
s[0]->a = 2;
}
然而,当我编译,我得到
test.c:21:7: error: member reference base type 'void' is not a structure or union
s[0]->a = 2;
我在做什么错?
非常感谢您的帮助:) Vik。
为什么参数'无效**'和'不**测试'? – Nabla
我需要从javascript中的nodejs的外部函数接口调用方法。它理解无效而不是自定义的结构。 –
请勿施放'malloc'的结果。 – Barmar