int size = sizeof(int[10]) ;//返回40 void *p = malloc(size);//分配一个40个BYTE的指针; int *pn = (int*)p;//然后p指针转换成int* //其实也就是pn指向一个可以容纳10个int的buffer.
[解决办法] malloc returns a void pointer to the allocated space, or NULL if there is insufficient memory available [解决办法] C++不允许讲void* 赋值给任何非void* 指针,所以需要强制转换, 但是C则没有这种限制!