我需要将一个数组转换为一个具有 void* 元素的结构,然后返回另一个数组:
unsigned short array[size];
//do something to the array
typedef struct ck{
void * arg1;
void * arg2;
void * arg3;
} argCookie;
argCookie myCookie;
myCookie.arg2=malloc(sizeof(array));//alloc the necessary space
memcpy(myCookie.arg2,&array,sizeof(array));//copy the entire array there
//later....
unsigned short otherArray[size];
otherArray=*((unsigned short**)aCookie.arg2);
碰巧这最后一行不会编译......为什么会这样?显然我在某个地方搞砸了......
谢谢你。