0
我想在结构体中有一个数组,它将存储相同数据类型的指针(即struct map
)。我看着#2,发现这个:无法将指针数组声明为struct struct C
struct map {
int city;
struct map **link = (struct map *)malloc(204800 * sizeof(struct map *));
}
但我收到此错误: -
error: expected ':', ',', ';', '}' or '__attribute__' before '=' token
struct map **link = (struct map *)malloc(204800*sizeof(struct map *));
malloc的结果不应该被铸造:http://stackoverflow.com/questions/605845/do-i-cast-the-result-of-malloc#605858 – SurvivalMachine
你到底想要达到什么目的? –