|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
i% b$ I& U3 w5 s) l8 T8 H
来个实例,大家看看7 i) }1 q5 o5 t, X1 |& P
3 K7 S+ ~( F0 B# }1 b
M2 O1 U2 I1 l5 K$ {- [/ x" G$ J
* z6 c2 i2 z1 \8 D- int obj_num = 10;7 H+ g+ z: b3 L1 y" n# ^
- tag_t *object = NULL;* Y1 q9 q8 i: m0 Z& j
- object = (tag_t *) UF_allocate_memory( obj_num * sizeof(tag_t), &error );
6 ?5 R: i0 f" z$ H4 n- E - object = (tag_t *) UF_reallocate_memory( object, (obj_num+1) * sizeof(tag_t), &error );
2 @+ m1 ^: e. c - UF_free( object );
. c' ]* Q) u( d6 Z5 B& L - char **strings = NULL;$ K7 R- V* X( C1 M' ~) ~2 o2 h- F
- strings = (char **) UF_allocate_memory( 10 * sizeof(char *), &error );4 @9 H' J# x9 R* t- B
- for ( i = 0; i < 10; i ++ )( J+ {$ N8 U4 c7 [
- { strings[i] = NULL; * ?. p) J$ l# [2 }
- strings[i] = (char *) UF_allocate_memory( 133 * sizeof(char), &error );
3 V+ q* @7 \7 ]! E( h9 j* p& c - }, S$ n' {5 K# R, K5 S
- UF_free_string_array( 10, strings );% k3 m; m8 T' _% K4 G
- double (*point_coords)[3];
: K" r' t( N4 r2 k7 L - point_coords = (double (*)[3]) UF_allocate_memory( 10 * sizeof(double [3]), &error );
3 P+ r) p3 F0 d - Static void my_function ( int *num, tag_t **object )
! o6 I! I. u4 a9 j" i' F4 g) K0 B - {
# f# f$ @3 H) A6 I2 N& t# p - (*num) = 10;0 i5 ?" g2 N4 C
- (*object) = (tag_t *) UF_allocate_memory( (*num) * sizeof(tag_t), &error );& ?6 } s- H1 t
- (*object)[0] = NULL_TAG;% f( B3 T, f+ E. k% K
- }# d2 |4 H' s, H( ]. S0 e( ?
复制代码 typedef struct UF_CURVE_line_s {
8 Y) F& Z# A( c3 y7 I* A3 T S$ ~) y double start_point[3]; & ~ ^. L8 X; U# a
double end_point[3]; 3 T7 K) r. C8 G2 N8 [7 }1 r, P
} UF_CURVE_line_t, * UF_CURVE_line_p_t;
: j. v7 n! g5 E/ O" S% E) V . @' |3 G4 `) v8 f# c
UF_CURVE_line_t my_line; % G8 y5 e7 e( a
my_line.start_point[0] = 0.0;
) U4 i$ C2 c' q* h
" z& o4 a6 ]4 N+ ` UF_CURVE_line_t *my_line;
+ L) }' i# J" Q2 x; O9 g8 i my_line->start_point[0] = 0.0;
' V: x9 T4 V! r0 D
) Z! Q; c- Z: | UF_CURVE_line_p_t my_line;
. L5 ^( f2 e; @* v N8 m- f my_line->start_point[0] = 0.0;
2 U4 R7 O4 b4 _; O7 t! L2 [
& {* U6 J% Y4 O, U3 ~ Q& _$ y+ {: i$ l$ D# H' C- i; K$ c4 Y
|
|