I have two structs:
struct Parent {
struct *Child child; // Pointer to a child
}
struct Child {
int id;
}
I wish to init an array of 'Parent'
int size = 2;
struct Parent *parents = (struct Parent*) malloc(sizeof(struct Parent) * size);
this breaks when runs.
Any solution for this?
I want to initialize in such way:
struct Parent {
struct *Child child = nullptr; // Points to null upon initialization.
}