Go/CGo - how do you use a C array passed as a pointer
问题 I'm posting this as a question/answer, as it took me a while to work out, and I wouldn't mind some feedback on my solution. In Go/CGo, how do you work with a C array passed as a pointer? For example, with this C struct: struct _GNetSnmpVarBind { guint32 *oid; /* name of the variable */ gsize oid_len; /* length of the name */ ... and other fields }; I want to convert oid field to a Go string, how would I work with the guint32* pointer? 回答1: You could convert the C array into a Go slice using a