27 lines
545 B
C
27 lines
545 B
C
|
#ifndef ARRAY_INDEX_H_
|
||
|
#define ARRAY_INDEX_H_
|
||
|
|
||
|
#define USER_INDEX_MAX (100 + 2)
|
||
|
#define GROUP_INDEX_MAX (20 + 2)
|
||
|
|
||
|
typedef struct array
|
||
|
{
|
||
|
unsigned int* array; //数组
|
||
|
int cur; //当前可用
|
||
|
int size; //数组大小
|
||
|
}ARRAY;
|
||
|
|
||
|
/*初始化数组*/
|
||
|
int init_array(ARRAY* head, int index_size);
|
||
|
|
||
|
/*顺序添加*/
|
||
|
unsigned short alloc_index(ARRAY* head);
|
||
|
|
||
|
/*指定添加*/
|
||
|
unsigned short alloc_index_special(ARRAY* head, unsigned short index);
|
||
|
|
||
|
/*指定释放*/
|
||
|
void free_index(ARRAY* head, unsigned short index);
|
||
|
|
||
|
#endif
|