我试图让一个结构中的指针指向另一个类型的结构数组。这是我的代码:
struct Mesh
{
long masterRef; // The global fragment number
long polygonCount; // Number of polygons in the mesh
long vertexCount; // Number of verticies in the mesh
Vertex *verti; // Pointer to verticies in the mesh
Poly *poly; // Pointer to polygons in the mesh
float center[3]; // The center of the mesh
bool isVisible; // Is the mesh currently visible?
} typedef Mesh;
struct Region
{
bool hasPoly;
long size1;
long size2;
long size3;
long size4;
long size5;
long size6;
Mesh* meshptr; // the mesh with the polygons for this region
long meshRef;
std::vector<int> visvector;
long regionsVisible;
};
如您所见,我正在尝试在 Region 结构中创建一个网格指针。指针将指向网格数组中的一个网格。仅此行会导致程序崩溃,并显示调试断言失败消息和“表达式:无效空指针”
有谁知道是什么问题?我会发布调用代码,但没有它它会崩溃。