1 extern void abort(void);
3 typedef struct myCDerived
12 #define DERIVED_ARRAY_LEN 10
17 void testDerivedPtrs(myCDerived_t
*cDerivedPtr
,
18 myCDerived_t
*derivedArray
, int arrayLen
,
19 myCDerived_t
*derived2d
, int dim1
, int dim2
);
21 int main(int argc
, char **argv
)
23 myCDerived_t cDerived
;
24 myCDerived_t derivedArray
[DERIVED_ARRAY_LEN
];
25 myCDerived_t derived2DArray
[DIM1
][DIM2
];
30 cDerived
.cDouble
= 2.0;
31 cDerived
.cFloat
= 3.0;
33 /* cDerived.ptr = NULL; */
37 for(i
= 0; i
< DERIVED_ARRAY_LEN
; i
++)
39 derivedArray
[i
].cInt
= (i
+1) * 1;
40 derivedArray
[i
].cDouble
= (i
+1) * 1.0; /* 2.0; */
41 derivedArray
[i
].cFloat
= (i
+1) * 1.0; /* 3.0; */
42 derivedArray
[i
].cShort
= (i
+1) * 1; /* 4; */
43 /* derivedArray[i].ptr = NULL; */
44 derivedArray
[i
].ptr
= 0;
47 for(i
= 0; i
< DIM1
; i
++)
49 for(j
= 0; j
< DIM2
; j
++)
51 derived2DArray
[i
][j
].cInt
= ((i
*DIM1
) * 1) + j
;
52 derived2DArray
[i
][j
].cDouble
= ((i
*DIM1
) * 1.0) + j
;
53 derived2DArray
[i
][j
].cFloat
= ((i
*DIM1
) * 1.0) + j
;
54 derived2DArray
[i
][j
].cShort
= ((i
*DIM1
) * 1) + j
;
55 /* derived2DArray[i][j].ptr = NULL; */
56 derived2DArray
[i
][j
].ptr
= 0;
60 /* send in the transpose size (dim2 is dim1, dim1 is dim2) */
61 testDerivedPtrs(&cDerived
, derivedArray
, DERIVED_ARRAY_LEN
,
62 derived2DArray
[0], DIM2
, DIM1
);