Arnaud Courtecuisse
Arnaud Courtecuisse

Reputation: 367

What typedef for a static multi-dimensional array?

I have a static 3D array of int. I can declare it this way:

int my_array[X_MAX][Y_MAX][Z_MAX];

However, this type is used for different purposes in my program, and I'd like to create typedefs to differentiate the usages and make my program easier to read.

Problem is... I don't know how to create these typedefs. typedef int[X_MAX][Y_MAX][Z_MAX] my_typedef; was my first and only guess. It doesn't compile. Do you know if there is a way to do what I want? (I mean, with no dynamically-allocated array)

Upvotes: 0

Views: 126

Answers (1)

user1202136
user1202136

Reputation: 11567

typedef int my_typedef[X_MAX][Y_MAX][Z_MAX];

Upvotes: 5

Related Questions