|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
( L9 z+ a4 ^% U# B
来个实例,大家看看
$ C3 D, k: M( t
) c' l2 q: H' i( L0 D; z, ]( [4 L; K. t4 d$ y( L z' R+ u
" T. X% Q# y% ~- p( f5 w- int obj_num = 10;
9 C% ^4 P; c: }' H7 [ - tag_t *object = NULL;
$ ]5 \1 u! P" `; d6 ^2 s - object = (tag_t *) UF_allocate_memory( obj_num * sizeof(tag_t), &error );
4 @/ j: z" ~3 I/ p( i1 B! n6 { - object = (tag_t *) UF_reallocate_memory( object, (obj_num+1) * sizeof(tag_t), &error );1 Q" j" H$ h7 B0 W
- UF_free( object );, S! Q& _. d; U; k, `
- char **strings = NULL;
, W4 Q- L/ ~' ]- N - strings = (char **) UF_allocate_memory( 10 * sizeof(char *), &error );
3 N" S: Y! U" J3 T$ o4 T3 @ - for ( i = 0; i < 10; i ++ )2 j( I( I h8 r# [
- { strings[i] = NULL;
" u' z) R# X& @, N' D, Z8 L - strings[i] = (char *) UF_allocate_memory( 133 * sizeof(char), &error );; c0 Y. ~" H) x5 S8 J
- }4 ?/ q( m! e" @, }
- UF_free_string_array( 10, strings );
. }' ^1 `! j# u, o& r* |4 u - double (*point_coords)[3]; `( q! o7 a$ y0 e; v
- point_coords = (double (*)[3]) UF_allocate_memory( 10 * sizeof(double [3]), &error );( t/ N$ Q1 g% \. K
- Static void my_function ( int *num, tag_t **object )5 L/ x9 {+ y. X* r
- { $ U; Y/ ^$ W$ B& {
- (*num) = 10;
$ W+ f. L! T& i) j( e0 r - (*object) = (tag_t *) UF_allocate_memory( (*num) * sizeof(tag_t), &error );
/ m/ U; D) U* i7 S c8 m7 w - (*object)[0] = NULL_TAG;
- f, g" Q9 _8 E+ k K2 J8 Z' G/ ]* O - }/ A) q! u$ ~5 z% }
复制代码 typedef struct UF_CURVE_line_s { + d$ m" Q8 f3 J: P0 a) c' L& ]5 t
double start_point[3]; / R. |! h9 [6 z+ O& ~
double end_point[3]; ! h* x7 G5 j6 t% q: I
} UF_CURVE_line_t, * UF_CURVE_line_p_t; , t3 k4 m# @2 E( l# q
/ S1 o2 m2 J$ Y: r2 R9 m% b) ? UF_CURVE_line_t my_line;
6 S9 C ]) j9 [9 U$ g my_line.start_point[0] = 0.0;; j/ J7 F6 R# q) [; q) a+ S" a8 U/ F
: v a% {+ ~# @$ _ l. r% z UF_CURVE_line_t *my_line;
' @9 L- e' B$ {" `3 h9 D- w5 I my_line->start_point[0] = 0.0;
6 t2 c0 k4 D8 `# Q, F
0 }. [/ a) A3 r* k* `0 b. {9 [" C UF_CURVE_line_p_t my_line;
}, u; ], \& b; S: n& s* i my_line->start_point[0] = 0.0;" ]3 d: \$ A: z! @3 m
# ^! A$ I1 G- |+ {3 j" {1 N
; z( c' t; ~' K% U0 Q1 O0 R |
|