只需要把结构体的第一个属性做为类型判断即可
//普通用户 Typedef struct user{ char type; Char *name; } //会员 Typedef struct member{ char type; Char *name; } //把上面的结构体作为指针传入下面的函数,在函数里判断传入的是会员还是用户 Void test(void* t){ Char a = (char)(*(char*)t) }
原文:https://www.cnblogs.com/cfas/p/14289168.html