|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
3 X( y3 G [- @/ {- \+ K
来个实例,大家看看
! j/ H/ n5 q0 h: O: ~3 d5 {( J) X8 \ B e
8 o4 S4 u( S$ I1 z/ ~; ^, j9 t# `" n- x% H5 |
- int obj_num = 10;
+ l! v/ W6 ]; |+ i5 V - tag_t *object = NULL;
* h% C" b4 Q! T - object = (tag_t *) UF_allocate_memory( obj_num * sizeof(tag_t), &error );, g. z9 K$ m% S+ @! l' a
- object = (tag_t *) UF_reallocate_memory( object, (obj_num+1) * sizeof(tag_t), &error );
$ J$ k5 N: m( _ P5 N' b; ~3 d/ L, K - UF_free( object );4 c( ?; d7 O `9 F; f
- char **strings = NULL;
" B# \3 Y3 m- G9 `& U: G+ q - strings = (char **) UF_allocate_memory( 10 * sizeof(char *), &error );
9 [+ E& ` H, s- Y1 m - for ( i = 0; i < 10; i ++ )
( H# a0 A# B4 p$ | - { strings[i] = NULL; 6 ]8 p. F' G, s5 P0 Z: ]4 S
- strings[i] = (char *) UF_allocate_memory( 133 * sizeof(char), &error );4 c. N& j7 s/ e+ R& @ k" A
- }
4 f% O U, u# Q - UF_free_string_array( 10, strings );
4 n& k' l# u8 Z+ d' R( T# z& I - double (*point_coords)[3];5 I$ j/ F: B' c! {7 C$ t8 `3 H
- point_coords = (double (*)[3]) UF_allocate_memory( 10 * sizeof(double [3]), &error );% c/ n9 P! S0 l- O8 J. Z
- Static void my_function ( int *num, tag_t **object )
) O# K4 L! h" c+ @ - {
* x; q* c* w0 e& q8 a d" [ - (*num) = 10;
. S7 u9 `* A6 Y0 t - (*object) = (tag_t *) UF_allocate_memory( (*num) * sizeof(tag_t), &error );
; {) X" H8 e/ N& y6 T" A# p. d - (*object)[0] = NULL_TAG; K6 l# w% L+ T
- }+ Y% f8 d* @: @" F$ e/ ^
复制代码 typedef struct UF_CURVE_line_s { $ u4 r, Q: C0 Z; ?: |4 R% t
double start_point[3]; + O7 o8 q; H& I5 B. n+ k
double end_point[3]; + z; q9 T, B7 ]9 @1 C' o% Y" j
} UF_CURVE_line_t, * UF_CURVE_line_p_t; 6 M$ y& s( W' T) F) q, X8 V
( E. @( u3 O7 X* |; [/ n" j. f
UF_CURVE_line_t my_line;
' w8 V7 ~) g& I) Z0 k my_line.start_point[0] = 0.0;) U6 z& T; I) J+ o+ s" h7 Q# G* `
. Z* y& h% p, U" w' u/ J UF_CURVE_line_t *my_line;
; H2 E" o2 V3 L- c+ U/ z1 R: q my_line->start_point[0] = 0.0;
' P* L/ P9 N* @% F/ h
! Y9 e4 f6 R* d+ G& p1 f+ n UF_CURVE_line_p_t my_line; - r5 |1 Y, k2 S8 @6 o, }4 b
my_line->start_point[0] = 0.0;
$ u; @7 t6 }6 O, k! _! G& x5 f$ ~6 s
: B$ \6 {! W. I& C9 w+ ^ |
|