A simple structure to hold 2d uint8 arrays in C that can be easily adjusted to hold other things in other dimensions.
Usage is as follows:
struct uint8_tensor * t = create_tensor(2, 2);
t->set(t, 0, 0, 0);
t->set(t, 0, 1, 1);
t->set(t, 1, 0, 1);
t->set(t, 1, 1, 0);
// t->data == {0, 1, 1, 0}
destroy_tensor(t); // Don't forget to deallocate to avoid memory leaks!