bmacrevolution bmacrevolution - 3 months ago 71
C Question

What is the Golang equivalent of a void pointer

I am already familiar with C and I've been working on improving my Golang skills. Anyone know how to create something reminiscent of a void * in Golang?

For example:

struct Node {
void *data;
struct Node *next;
struct Node *prev;
}

Answer

You have to use an empty interface, (interface {}), and modify it to what you want. (Source). This is known as an empty interface, and it can embody any type.

Comments