In numpy, you can access the size and shape of the array with array.size
and array.shape
while elements can be accessed using array[i]
.
How does one achieve this with a C structure? One can do something like
struct{
int size;
int shape[2];
int *elements;
} int_array;
but then elements can be accessed as
int_array.elements[i].
not like numpy.
How can I have an array that stores size and shape, but whose elements can be accessed in the usual way using []?