小编Adh*_*esh的帖子

无法在C中声明struct里面的struct指针数组

我想在struct中有一个数组,它将存储相同数据类型(即struct map)的指针.我查看了Stackoverflow,发现了这个:

struct map {
    int city;
    struct map **link = (struct map *)malloc(204800 * sizeof(struct map *));
}
Run Code Online (Sandbox Code Playgroud)

但是我收到了这个错误: -

error: expected ':', ',', ';', '}' or '__attribute__' before '=' token    
    struct map **link = (struct map *)malloc(204800*sizeof(struct map *));
Run Code Online (Sandbox Code Playgroud)

c arrays struct pointers

0
推荐指数
1
解决办法
78
查看次数

标签 统计

arrays ×1

c ×1

pointers ×1

struct ×1