08-03-2013 12:03 PM - edited 08-03-2013 12:04 PM
Hello,
what is the correct way of passing Array handle dimensions, I found this document, that only describes the memory situation and some examples that suggest both following possibilities:
typedef struct { dimSizes[dimensions] ArrDatatype data[1]; } Array **ArrayHdl;
or this one:
typedef struct { int32 dimSize1; . . . . int32 dimSizeX; ArrDatatype data[1]; } Array **ArrayHdl;
Solved! Go to Solution.
08-05-2013 03:10 AM - edited 08-05-2013 03:13 AM
@Bublina wrote:
Hello,
what is the correct way of passing Array handle dimensions, I found this document, that only describes the memory situation and some examples that suggest both following possibilities:
typedef struct { dimSizes[dimensions] ArrDatatype data[1]; } Array **ArrayHdl;
or this one:
typedef struct { int32 dimSize1; . . . . int32 dimSizeX; ArrDatatype data[1]; } Array **ArrayHdl;
They are equivalent, except that the int32 has been forgotten in the first one!
And a comma in the type declaration for both!
Personally I tend to use the second one, but never did more than 2D arrays. For multi-D arrays, the first may be interesting if you happen to loop through the array dimensions somehow.
08-05-2013 06:58 AM
Hi Bublina,
as rolfk said, both ways are correct. It depends which way will follow better your programming style. I would suggest the second one because there you can directly see how many dimensions are used. On the other side, the first one is more flexible.
Best regards,
Martin
08-06-2013 01:47 AM
Ok, thanks for reply. I use the second one, it makes the code more readable.