+ 11

Number of dimensions of multi-dimensional array in C?

Assume that a multi-dimensional array of integers is passed to a function in C. I would like to determine by the function how many dimensions this array in C has. Is this even possible without passing the number of dimensions to the function? The array should have an arbitrary number of dimensions. As a secondary question: Is there a limit of dimensions in an array?

10th Jan 2021, 12:03 PM
Jan Markus
2 Réponses
+ 5
I also don't think there is a limit to the number of dimensions apart from memory limits. In general anything more than 3 or 4 dimensions is not common.
11th Jan 2021, 12:11 AM
Sonic
Sonic - avatar