我收到一个不兼容的类型错误,如下所示:
error: incompatible types when assigning to type ‘struct cache *’ from type ‘cache’
我有以下结构。
typedef struct __region {
int size;
void *addr;
struct __region *next;
} region;
typedef struct {
int size;
int remainingSpace;
void *addr;
char *bitmap;
struct cache *parent;
struct slab *next;
} slab;
typedef struct {
int alloc_unit;
int slab_counter;
slab *S;
} cache;
typedef struct {
region *R;
cache C[8];
} memory;
我运行的收到错误的代码是:
memory M;
M.C[0].S->parent = M.C[0];