I'm not positive this is even possible, but I am basically trying to define a struct with an array of the same struct inside of it, like so
struct Node {
int numMatches = 0;
Node* leaves[26] = {};
};
Each node would contain a fixed-length array of pointers to other nodes (representing letters). I'm trying to recurse through these nodes, going into the relevant leaf whenever I need. I would initialize a "head" Node* array and bubble down that way. It's seg faulting immediately, and I can see why that might be - it doesn't know how much memory to alloc to an array of such structs. Not quite sure how to solve the problem though.
Pretty simple issue, but I haven't found any C++/C specific threads with this same question.
Thanks!
Node* leaves[26] = {NULL};would initialize the array of pointer to NULL. Better than nothing I guess. We would need to see your context code to help you further.Node*pointers? Can you provide a minimal reproducible example that reproduces your problem please?