I am trying to implement a non-rectangular, multi-dimensional array in C, i.e. something like this:
[1, 2, [3, [4, 5, [6]]], 7]
As of now I am using a tree like this:
enum item_type { ELEMENT, ARRAY };
struct item {
int value;
struct item *next;
enum item_type type;
};
Could this be simplified or improved somehow?
EDIT: to clarify more this a part of an exercise to "translate" some concepts from higher level languages, like for example the following python code:
array = [1, 2, [3, [4, 5, [6]]], 7]