How to access a four dimensional array?
Hello,
I have never used multidimensional array for a long time so please consider this as a newbie question. I am editing a program that uses a 4 dimensional array and I think I'm losing track of the indexes. day = 0 to 30 hour = 0 to 23 channel = 0 to 7 len = 0 to 63 unsigned char idx[day][channel][hour][len]; I have seen that the assignment to a string is snprintf(idx[day][hour][channel], 64, "%s/%s", dayofmonth, hourofday); Is this correct? Because when I access with a day argument, that day value goes into the hour part. Regards, archieval |
That does not look like a "4-dimensional array". What I see is a simple structure with each entry having the four elements.
For the data ranges you show, a 4-D array would have 31*24*8*1 = 5952 discrete points. |
Quote:
MT |
Quote:
Regards, archieval |
Quote:
snprintf(idx[day][channel][hour], 64, "%s/%s", dayofmonth, hourofday); |
Quote:
|
To me, a "4-dimensional array" is a structure with 4 numerical indices, where a particular combination of indices produces a value (or another structure)
It seems like you want to use the ranges you specified as the data, and not as the array indices. |
Quote:
http://fruttenboel.verhoeven272.nl/mocka/index.html |
Quote:
Regards, archieval |
Quote:
Regards, archieval |
All times are GMT -5. The time now is 03:02 AM. |