33 lines
753 B
C
33 lines
753 B
C
#ifndef HW_LIB_ARRAY_H
|
|
#define HW_LIB_ARRAY_H
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
// 在数组的索引 index 处插入元素 num
|
|
// nums: 操作数组
|
|
// size: 数组大小
|
|
// num: 操作数
|
|
// index: 操作位置
|
|
void insert(int *nums, int size, int num, int index);
|
|
|
|
// 删除索引 index 处的元素
|
|
// nums: 操作数组
|
|
// size: 数组大小
|
|
// index: 索引位置
|
|
// 注意:stdio.h 占用了 remove 关键词
|
|
void removeItem(int *nums, int size, int index);
|
|
|
|
// 在数组中查找指定元素
|
|
// nums: 操作数组
|
|
// size: 数组大小
|
|
// target: 查找元素
|
|
int find(int *nums, int size, int target);
|
|
|
|
/* 扩展数组长度 */
|
|
int *extend(int *nums, int size, int enlarge);
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif //HW_LIB_ARRAY_H
|