c - 空指针的 Golang 等价物是什么

标签 c go

<分区>

我已经熟悉 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/

相关文章:

c - #define 的数组格式(C 预处理器)

c - 将结构传递给 c 中的函数时出错

unit-testing - 子目录的 golang 测试失败

戈朗 : Zip Package Modified Time Defaults to 30 November 1979, 00:00

go - 如何使用 proxy.ModifyResponse?

go - 如何将 uint16 序列转换为 float32?

c++ - 在 OpenGL 中创建环境堆栈

c - 如何处理索引大于 32 位的数据结构?

C bool 创建和插入值而不调用结构成员 - 直接值插入

mongodb - 从 channel 读取 SIGSEGV : segmentation violation