|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
: T5 a/ Q, x$ F# W来个实例,大家看看7 I( b4 h. ?; O, v
. Y' y1 u% o- R7 j
/ U! v F y1 a2 @1 Y) {
) P$ |! \7 f" h, J. x- int obj_num = 10;/ }! Y0 f0 L4 |
- tag_t *object = NULL;
# D, I9 z; V q- s - object = (tag_t *) UF_allocate_memory( obj_num * sizeof(tag_t), &error );
! X# D" V! G% w/ G - object = (tag_t *) UF_reallocate_memory( object, (obj_num+1) * sizeof(tag_t), &error );
9 r( u( F, T$ S - UF_free( object );
2 ~6 W- O" I5 x$ }3 e - char **strings = NULL;& [0 f. Z1 e7 X
- strings = (char **) UF_allocate_memory( 10 * sizeof(char *), &error );
+ I" Y. ]" h; ]; i* B% H( D' x - for ( i = 0; i < 10; i ++ )5 n4 X( x' Y- I/ z
- { strings[i] = NULL; . X: g- e/ r; ?; t
- strings[i] = (char *) UF_allocate_memory( 133 * sizeof(char), &error );
J3 P6 Z% u8 ]# U. } - }8 {: s7 P8 @0 i, e- D" N) p
- UF_free_string_array( 10, strings );
4 ~3 G% N8 J. u, `, z - double (*point_coords)[3];
# U( L' c2 _; l# ? - point_coords = (double (*)[3]) UF_allocate_memory( 10 * sizeof(double [3]), &error );
0 O( K! i, I9 E0 B6 _( g: N - Static void my_function ( int *num, tag_t **object )
2 H& {1 s. X1 j" n, Q - { E0 q, A% _5 t1 T/ ]5 w7 m4 o9 M
- (*num) = 10;
9 H7 e3 f7 {! K. V% ]3 s7 V; ? - (*object) = (tag_t *) UF_allocate_memory( (*num) * sizeof(tag_t), &error );
3 u9 M( ^. x$ J - (*object)[0] = NULL_TAG;9 d2 H$ t7 b9 W" P) o* L
- }1 C% ^/ p6 f; W
复制代码 typedef struct UF_CURVE_line_s {
) E5 y0 ~) _4 E. x- N8 ^- L1 D double start_point[3]; A" K0 |# c; o/ z9 A) ]+ V
double end_point[3];
6 T/ W; D9 Z- @ } UF_CURVE_line_t, * UF_CURVE_line_p_t; : H9 G5 |% K, ]" A+ s5 e" K7 S
$ u+ p3 f9 C; ^2 [, c9 j+ _/ ?/ S UF_CURVE_line_t my_line; e, C# b; V6 n
my_line.start_point[0] = 0.0;3 \" h6 A5 H( v
' T+ E4 P, V% ^ I0 b* s. ]/ g UF_CURVE_line_t *my_line;
% `2 ~5 C- ?$ N' g9 ~; E4 r: x my_line->start_point[0] = 0.0;
% p/ s) x8 F& T& Z& T3 V1 Y! ?. j( V' Z
UF_CURVE_line_p_t my_line;
- ~8 Y: n# c# P. T0 y my_line->start_point[0] = 0.0;
2 v3 B. w. Z1 Q
3 K1 \( u+ X$ r f9 Y6 c9 b+ n2 P8 P! h
) L; T7 V/ v z, O" ]! i |
|