我正在制作一个 C 程序,它需要访问结构中的结构数组。
定义如下所示
struct def_world
{
bool lock;
char tilemap;
def_tile tile[100][100];
struct def_tile
{
bool lock;
char kind;
def_obj * obj;
void * evt;
};
struct def_obj
{
bool lock;
int indexOfTable;
bool frozen;
char x,y;
char kind;
char face;
char * msg;
char * ip;
};
在主函数中,我想访问世界的tile[3][3]
obj 的脸。
我将世界初始化为
def_world world={0,};
但以下几行会出错
world.tile[3][3].obj=newobj();//newobj() returns def_obj type
world.tile[3][3].obj->face;
知道如何访问 obj 的脸吗?