<分区>
我已经熟悉 C,并且一直在努力提高我的 Golang 技能。有人知道如何在 Golang 中创建类似于 void * 的东西吗?
例如:
struct Node {
void *data;
struct Node *next;
struct Node *prev;
}
<分区>
我已经熟悉 C,并且一直在努力提高我的 Golang 技能。有人知道如何在 Golang 中创建类似于 void * 的东西吗?
例如:
struct Node {
void *data;
struct Node *next;
struct Node *prev;
}
最佳答案
您必须使用一个空接口(interface),(interface {}
),并将其修改为您想要的。 (Source)。这称为空接口(interface),它可以体现任何类型。
关于c - 空指针的 Golang 等价物是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38820047/