a value of type "void *" cannot be assigned to an entity of type "int *"
->arrary = malloc(sizeof(int) * 10)
malloc 代码没问题。您收到此警告是因为 VS 是不合格的编译器,或者因为您正在将代码编译为 C++。如果将VS设置为C模式编译后问题依然存在,请换一个更好的编译器。
通过强制转换更改解决:
->arrary = (int *)malloc(sizeof(int))