我有一个结构和一个初始化函数,如下所示:
struct someStruct {
int* b, r; // r is a pointer to an integer in b
};
someStruct* init_struct(size_t size) {
someStruct* p = (someStruct*) malloc(sizeof(someStruct));
p->b = (int*) malloc(size);
p->b[0] = 16;
p->r = &p->b; // Here's the error, why?
return p;
}