when defining new data types in C, one can do
typedef double BYTE;
so later it is possible to do
BYTE length;
etc
I would like to do something like
typedef double[30][30][10] mymatrix;
so later I do
mymatrix AA[10];
so I have 10 matrices of type mymatrix, and I can access them through AA[0], AA[1], etc
Anyway doing this with the GNU C compiler I get errors like
error: expected unqualified-id before '[' token
What am I doing wrong or how could I achieve my objective?
Thanks
The simple answer is define an object named & declared as you want, then stick typedef
in front:
double mymatrix[30][30][10] ; // defines a 3-d array.
typdef double mymatrix[30][30][10] ; // defines a 3-d array type
mymatrix matrix;
Follow "declaration looks like use" C idea:
typedef double mymatrix[30][30][10];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With